Heightmap.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Open Source Robotics Foundation
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 #ifndef SDF_HEIGHTMAP_HH_
18 #define SDF_HEIGHTMAP_HH_
19 
20 #include <string>
21 #include <ignition/math/Vector3.hh>
22 #include <sdf/Element.hh>
23 #include <sdf/Error.hh>
24 #include <sdf/sdf_config.h>
25 
26 namespace sdf
27 {
28  // Inline bracket to help doxygen filtering.
29  inline namespace SDF_VERSION_NAMESPACE {
30  //
31 
32  // Forward declare private data class.
33  class HeightmapPrivate;
34  class HeightmapTexturePrivate;
35  class HeightmapBlendPrivate;
36 
39  {
41  public: HeightmapTexture();
42 
45  public: HeightmapTexture(const HeightmapTexture &_texture);
46 
49  public: HeightmapTexture(HeightmapTexture &&_texture) noexcept;
50 
52  public: virtual ~HeightmapTexture();
53 
57  public: HeightmapTexture &operator=(HeightmapTexture &&_texture);
58 
62  public: HeightmapTexture &operator=(const HeightmapTexture &_texture);
63 
70  public: Errors Load(ElementPtr _sdf);
71 
74  public: double Size() const;
75 
78  public: void SetSize(double _uri);
79 
82  public: std::string Diffuse() const;
83 
86  public: void SetDiffuse(const std::string &_diffuse);
87 
90  public: std::string Normal() const;
91 
94  public: void SetNormal(const std::string &_normal);
95 
99  public: sdf::ElementPtr Element() const;
100 
102  private: HeightmapTexturePrivate *dataPtr;
103  };
104 
107  {
109  public: HeightmapBlend();
110 
113  public: HeightmapBlend(const HeightmapBlend &_blend);
114 
117  public: HeightmapBlend(HeightmapBlend &&_blend) noexcept;
118 
120  public: virtual ~HeightmapBlend();
121 
125  public: HeightmapBlend &operator=(HeightmapBlend &&_blend);
126 
130  public: HeightmapBlend &operator=(const HeightmapBlend &_blend);
131 
138  public: Errors Load(ElementPtr _sdf);
139 
142  public: double MinHeight() const;
143 
146  public: void SetMinHeight(double _minHeight);
147 
150  public: double FadeDistance() const;
151 
154  public: void SetFadeDistance(double _fadeDistance);
155 
159  public: sdf::ElementPtr Element() const;
160 
162  private: HeightmapBlendPrivate *dataPtr;
163  };
164 
168  {
170  public: Heightmap();
171 
174  public: Heightmap(const Heightmap &_heightmap);
175 
178  public: Heightmap(Heightmap &&_heightmap) noexcept;
179 
181  public: virtual ~Heightmap();
182 
186  public: Heightmap &operator=(Heightmap &&_heightmap);
187 
191  public: Heightmap &operator=(const Heightmap &_heightmap);
192 
199  public: Errors Load(ElementPtr _sdf);
200 
203  public: std::string Uri() const;
204 
207  public: void SetUri(const std::string &_uri);
208 
211  public: const std::string &FilePath() const;
212 
215  public: void SetFilePath(const std::string &_filePath);
216 
219  public: ignition::math::Vector3d Size() const;
220 
223  public: void SetSize(const ignition::math::Vector3d &_size);
224 
227  public: ignition::math::Vector3d Position() const;
228 
231  public: void SetPosition(const ignition::math::Vector3d &_position);
232 
235  public: bool UseTerrainPaging() const;
236 
239  public: void SetUseTerrainPaging(bool _use);
240 
243  public: unsigned int Sampling() const;
244 
247  public: void SetSampling(unsigned int _sampling);
248 
251  public: uint64_t TextureCount() const;
252 
259  public: const HeightmapTexture *TextureByIndex(uint64_t _index) const;
260 
263  public: void AddTexture(const HeightmapTexture &_texture);
264 
267  public: uint64_t BlendCount() const;
268 
275  public: const HeightmapBlend *BlendByIndex(uint64_t _index) const;
276 
279  public: void AddBlend(const HeightmapBlend &_blend);
280 
284  public: sdf::ElementPtr Element() const;
285 
287  private: HeightmapPrivate *dataPtr;
288  };
289  }
290 }
291 #endif
Texture to be used on heightmaps.
Definition: Heightmap.hh:38
Blend information to be used between textures on heightmaps.
Definition: Heightmap.hh:106
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
Heightmap represents a shape defined by a 2D field, and is usually accessed through a Geometry...
Definition: Heightmap.hh:167
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
namespace for Simulation Description Format parser
Definition: Actor.hh:32
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:95