17#ifndef GAZEBO_RENDERING_HEIGHTMAP_HH_
18#define GAZEBO_RENDERING_HEIGHTMAP_HH_
23#include <ignition/math/Vector3.hh>
24#include <ignition/math/Vector2.hh>
26#include "gazebo/msgs/MessageTypes.hh"
55 class HeightmapPrivate;
83 public:
double Height(
const double _x,
const double _y,
84 const double _z = 1000)
const;
96 const ignition::math::Vector2i &_mousePos,
97 const double _outsideRadius,
98 const double _insideRadius,
99 const double _weight = 0.1);
111 const ignition::math::Vector2i &_mousePos,
112 const double _outsideRadius,
113 const double _insideRadius,
114 const double _weight = 0.1);
126 const ignition::math::Vector2i &_mousePos,
127 const double _outsideRadius,
128 const double _insideRadius,
129 const double _weight = 0.1);
141 const ignition::math::Vector2i &_mousePos,
142 const double _outsideRadius,
143 const double _insideRadius,
144 const double _weight = 0.1);
149 public:
double AvgHeight(
const ignition::math::Vector3d &_pos,
150 const double _brushSize)
const;
170 const ignition::math::Vector2i &_mousePos)
const;
177 const int _n, std::vector<std::vector<float> > &_v);
199 public:
void SetLOD(
const unsigned int _value);
203 public:
unsigned int LOD()
const;
226 private:
void CreateMaterial();
235 private:
void ModifyTerrain(Ogre::Vector3 _pos,
236 const double _outsideRadius,
const double _insideRadius,
237 const double _weight,
const std::string &_op);
241 private:
bool InitBlendMaps(Ogre::Terrain *_terrain);
244 private:
void ConfigureTerrainDefaults();
249 private:
void DefineTerrain(
const int _x,
const int _y);
253 private:
void SetupShadows(
const bool _enabled);
262 private:
void UpdateTerrainHash(
const std::string &_hash,
263 const boost::filesystem::path &_terrainDir);
270 private:
bool PrepareTerrain(
271 const boost::filesystem::path &_terrainDirPath);
274 private:
void SaveHeightmap();
278 private: std::unique_ptr<HeightmapPrivate> dataPtr;
common
Definition FuelModelDatabase.hh:37
rendering
Definition RenderEngine.hh:31
Encapsulates an image.
Definition Image.hh:66
Rendering a terrain using heightmap information.
Definition Heightmap.hh:63
virtual ~Heightmap()
Destructor.
common::Image Image() const
Get the heightmap as an image.
Ogre::TerrainGroup * OgreTerrain() const
Get a pointer to the OGRE terrain group object.
double AvgHeight(const ignition::math::Vector3d &_pos, const double _brushSize) const
Get the average height around a point.
bool Raise(CameraPtr _camera, const ignition::math::Vector2i &_mousePos, const double _outsideRadius, const double _insideRadius, const double _weight=0.1)
Raise the terrain based on a mouse press.
bool Smooth(CameraPtr _camera, const ignition::math::Vector2i &_mousePos, const double _outsideRadius, const double _insideRadius, const double _weight=0.1)
Smooth the terrain based on a mouse press.
Heightmap(ScenePtr _scene)
Constructor.
bool Lower(CameraPtr _camera, const ignition::math::Vector2i &_mousePos, const double _outsideRadius, const double _insideRadius, const double _weight=0.1)
Lower the terrain based on a mouse press.
unsigned int LOD() const
Get the heightmap Level of Detail (LOD) value.
void LoadFromMsg(ConstVisualPtr &_msg)
Load the heightmap from a visual message.
void SetLOD(const unsigned int _value)
Set the Level Of Detail (LOD) for the heightmap.
bool Flatten(CameraPtr _camera, const ignition::math::Vector2i &_mousePos, const double _outsideRadius, const double _insideRadius, const double _weight=0.1)
Flatten the terrain based on a mouse press.
bool CastShadows() const
Get whether the heightmap terrain casts shadows.
void SetSkirtLength(const double _value)
Set the skirt length for the heightmap LOD tiles.
double Height(const double _x, const double _y, const double _z=1000) const
Get the height at a location.
double SkirtLength() const
Get the skirt length of LOD tiles.
Ogre::TerrainGroup::RayResult MouseHit(CameraPtr _camera, const ignition::math::Vector2i &_mousePos) const
Calculate a mouse ray hit on the terrain.
std::string MaterialName() const
Get the custom material name used for the terrain.
void SetWireframe(const bool _show)
Set the heightmap to render in wireframe mode.
void SplitHeights(const std::vector< float > &_heightmap, const int _n, std::vector< std::vector< float > > &_v)
Split a terrain into subterrains.
void SetCastShadows(const bool _value)
Set the heightmap terrain to cast shadows.
void Load()
Load the heightmap.
void SetMaterial(const std::string &_materialName)
Set custom material for the terrain.
unsigned int TerrainSubdivisionCount() const
Get the number of subdivision the terrain will be split into.
Definition JointMaker.hh:40
Definition JointMaker.hh:45
boost::shared_ptr< Camera > CameraPtr
Definition RenderTypes.hh:90
boost::shared_ptr< Scene > ScenePtr
Definition RenderTypes.hh:82
Forward declarations for the common classes.
Definition Animation.hh:27