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 <ignition/utils/ImplPtr.hh>
23#include <sdf/Element.hh>
24#include <sdf/Error.hh>
25#include <sdf/sdf_config.h>
26
27namespace sdf
28{
29 // Inline bracket to help doxygen filtering.
30 inline namespace SDF_VERSION_NAMESPACE {
33 {
36
43 public: Errors Load(ElementPtr _sdf);
44
47 public: double Size() const;
48
51 public: void SetSize(double _uri);
52
55 public: std::string Diffuse() const;
56
59 public: void SetDiffuse(const std::string &_diffuse);
60
63 public: std::string Normal() const;
64
67 public: void SetNormal(const std::string &_normal);
68
72 public: sdf::ElementPtr Element() const;
73
75 IGN_UTILS_IMPL_PTR(dataPtr)
76 };
77
80 {
82 public: HeightmapBlend();
83
90 public: Errors Load(ElementPtr _sdf);
91
94 public: double MinHeight() const;
95
98 public: void SetMinHeight(double _minHeight);
99
102 public: double FadeDistance() const;
103
106 public: void SetFadeDistance(double _fadeDistance);
107
111 public: sdf::ElementPtr Element() const;
112
114 IGN_UTILS_IMPL_PTR(dataPtr)
115 };
116
120 {
122 public: Heightmap();
123
130 public: Errors Load(ElementPtr _sdf);
131
134 public: std::string Uri() const;
135
138 public: void SetUri(const std::string &_uri);
139
142 public: const std::string &FilePath() const;
143
146 public: void SetFilePath(const std::string &_filePath);
147
150 public: ignition::math::Vector3d Size() const;
151
154 public: void SetSize(const ignition::math::Vector3d &_size);
155
158 public: ignition::math::Vector3d Position() const;
159
162 public: void SetPosition(const ignition::math::Vector3d &_position);
163
166 public: bool UseTerrainPaging() const;
167
170 public: void SetUseTerrainPaging(bool _use);
171
174 public: unsigned int Sampling() const;
175
178 public: void SetSampling(unsigned int _sampling);
179
182 public: uint64_t TextureCount() const;
183
190 public: const HeightmapTexture *TextureByIndex(uint64_t _index) const;
191
194 public: void AddTexture(const HeightmapTexture &_texture);
195
198 public: uint64_t BlendCount() const;
199
206 public: const HeightmapBlend *BlendByIndex(uint64_t _index) const;
207
210 public: void AddBlend(const HeightmapBlend &_blend);
211
215 public: sdf::ElementPtr Element() const;
216
218 IGN_UTILS_IMPL_PTR(dataPtr)
219 };
220 }
221}
222#endif
Blend information to be used between textures on heightmaps.
Definition Heightmap.hh:80
void SetMinHeight(double _minHeight)
Set the minimum height of the blend in meters.
double FadeDistance() const
Get the heightmap blend's fade distance.
Errors Load(ElementPtr _sdf)
Load the heightmap blend geometry based on a element pointer.
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.
void SetFadeDistance(double _fadeDistance)
Set the distance over which the blend occurs.
HeightmapBlend()
Constructor.
Texture to be used on heightmaps.
Definition Heightmap.hh:33
std::string Normal() const
Get the heightmap texture's normal map.
void SetDiffuse(const std::string &_diffuse)
Set the filename of the diffuse map.
double Size() const
Get the heightmap texture's size.
std::string Diffuse() const
Get the heightmap texture's diffuse map.
HeightmapTexture()
Constructor.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
void SetNormal(const std::string &_normal)
Set the filename of the normal map.
Errors Load(ElementPtr _sdf)
Load the heightmap texture geometry based on a element pointer.
void SetSize(double _uri)
Set the size of the texture in meters.
Heightmap represents a shape defined by a 2D field, and is usually accessed through a Geometry.
Definition Heightmap.hh:120
void SetUseTerrainPaging(bool _use)
Set whether the heightmap uses terrain paging.
void SetSampling(unsigned int _sampling)
Set the heightmap's sampling.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
Heightmap()
Constructor.
const std::string & FilePath() const
The path to the file where this element was loaded from.
ignition::math::Vector3d Size() const
Get the heightmap's scaling factor.
void SetPosition(const ignition::math::Vector3d &_position)
Set the heightmap's position offset.
Errors Load(ElementPtr _sdf)
Load the heightmap geometry based on a element pointer.
void SetUri(const std::string &_uri)
Set the URI to a grayscale image.
void SetSize(const ignition::math::Vector3d &_size)
Set the heightmap's scaling factor.
void AddTexture(const HeightmapTexture &_texture)
Add a heightmap texture.
void SetFilePath(const std::string &_filePath)
Set the path to the file where this element was loaded from.
void AddBlend(const HeightmapBlend &_blend)
Add a heightmap blend.
const HeightmapBlend * BlendByIndex(uint64_t _index) const
Get a heightmap blend based on an index.
uint64_t TextureCount() const
Get the number of heightmap textures.
ignition::math::Vector3d Position() const
Get the heightmap's position offset.
std::string Uri() const
Get the heightmap's URI.
bool UseTerrainPaging() const
Get whether the heightmap uses terrain paging.
unsigned int Sampling() const
Get the heightmap's sampling per datum.
const HeightmapTexture * TextureByIndex(uint64_t _index) const
Get a heightmap texture based on an index.
uint64_t BlendCount() const
Get the number of heightmap blends.
std::vector< Error > Errors
A vector of Error.
Definition Types.hh:106
std::shared_ptr< Element > ElementPtr
Definition Element.hh:54
namespace for Simulation Description Format parser
Definition Actor.hh:34
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:41