Loading...
Searching...
No Matches
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
26namespace 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 {
42
45 public: HeightmapTexture(const HeightmapTexture &_texture);
46
49 public: HeightmapTexture(HeightmapTexture &&_texture) noexcept;
50
52 public: virtual ~HeightmapTexture();
53
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
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
Blend information to be used between textures on heightmaps.
Definition Heightmap.hh:107
virtual ~HeightmapBlend()
Destructor.
double FadeDistance() const
Get the heightmap blend's fade distance.
HeightmapBlend(const HeightmapBlend &_blend)
Copy constructor.
HeightmapBlend()
Constructor.
HeightmapBlend(HeightmapBlend &&_blend) noexcept
Move constructor.
HeightmapBlend & operator=(const HeightmapBlend &_blend)
Copy Assignment operator.
void SetMinHeight(double _minHeight)
Set the minimum height of the blend in meters.
Errors Load(ElementPtr _sdf)
Load the heightmap blend geometry based on a element pointer.
void SetFadeDistance(double _fadeDistance)
Set the distance over which the blend occurs.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
double MinHeight() const
Get the heightmap blend's minimum height.
HeightmapBlend & operator=(HeightmapBlend &&_blend)
Move assignment operator.
Texture to be used on heightmaps.
Definition Heightmap.hh:39
HeightmapTexture & operator=(HeightmapTexture &&_texture)
Move assignment operator.
HeightmapTexture()
Constructor.
HeightmapTexture & operator=(const HeightmapTexture &_texture)
Copy Assignment operator.
std::string Normal() const
Get the heightmap texture's normal map.
double Size() const
Get the heightmap texture's size.
HeightmapTexture(HeightmapTexture &&_texture) noexcept
Move constructor.
Errors Load(ElementPtr _sdf)
Load the heightmap texture geometry based on a element pointer.
void SetNormal(const std::string &_normal)
Set the filename of the normal map.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
std::string Diffuse() const
Get the heightmap texture's diffuse map.
void SetSize(double _uri)
Set the size of the texture in meters.
virtual ~HeightmapTexture()
Destructor.
void SetDiffuse(const std::string &_diffuse)
Set the filename of the diffuse map.
HeightmapTexture(const HeightmapTexture &_texture)
Copy constructor.
Heightmap represents a shape defined by a 2D field, and is usually accessed through a Geometry.
Definition Heightmap.hh:168
uint64_t BlendCount() const
Get the number of heightmap blends.
Heightmap & operator=(const Heightmap &_heightmap)
Copy Assignment operator.
void SetUri(const std::string &_uri)
Set the URI to a grayscale image.
void SetUseTerrainPaging(bool _use)
Set whether the heightmap uses terrain paging.
Heightmap(Heightmap &&_heightmap) noexcept
Move constructor.
Heightmap(const Heightmap &_heightmap)
Copy constructor.
const HeightmapTexture * TextureByIndex(uint64_t _index) const
Get a heightmap texture based on an index.
const std::string & FilePath() const
The path to the file where this element was loaded from.
void SetSampling(unsigned int _sampling)
Set the heightmap's sampling.
ignition::math::Vector3d Size() const
Get the heightmap's scaling factor.
Heightmap & operator=(Heightmap &&_heightmap)
Move assignment operator.
void AddTexture(const HeightmapTexture &_texture)
Add a heightmap texture.
void AddBlend(const HeightmapBlend &_blend)
Add a heightmap blend.
void SetSize(const ignition::math::Vector3d &_size)
Set the heightmap's scaling factor.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
Errors Load(ElementPtr _sdf)
Load the heightmap geometry based on a element pointer.
void SetPosition(const ignition::math::Vector3d &_position)
Set the heightmap's position offset.
std::string Uri() const
Get the heightmap's URI.
bool UseTerrainPaging() const
Get whether the heightmap uses terrain paging.
Heightmap()
Constructor.
virtual ~Heightmap()
Destructor.
unsigned int Sampling() const
Get the heightmap's sampling per datum.
const HeightmapBlend * BlendByIndex(uint64_t _index) const
Get a heightmap blend based on an index.
void SetFilePath(const std::string &_filePath)
Set the path to the file where this element was loaded from.
ignition::math::Vector3d Position() const
Get the heightmap's position offset.
uint64_t TextureCount() const
Get the number of heightmap textures.
std::vector< Error > Errors
A vector of Error.
Definition Types.hh:89
std::shared_ptr< Element > ElementPtr
Definition Element.hh:53
namespace for Simulation Description Format parser
Definition Actor.hh:33
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:48