Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9 ➡️ 10 #458

Merged
merged 45 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f7dcdd7
Properly handle the requirement of C++17 at the CMake exported target…
traversaro Apr 28, 2020
ed963ac
Collision: don't load Surface without <surface> (#268)
scpeters May 7, 2020
e3d8745
[sdf8] Changelog links to BitBucket backup (#239)
chapulina May 7, 2020
53653c3
[sdf9] Changelog links to BitBucket backup (#240)
chapulina May 8, 2020
4bdfb0a
Add sdf9 changelog entries for #240, #251, #268
scpeters May 15, 2020
e33839f
Observe the CMake variable BUILD_TESTING if it is defined (#269)
traversaro May 15, 2020
6ba0bbe
Param_TEST: test parsing +Inf and -Inf
scpeters May 13, 2020
b6f73d9
Add sdf9 changelog entries for #269, #277.
scpeters May 18, 2020
33d24e6
Backport bionic actions CI to sdf9 (#311)
scpeters Jun 30, 2020
7b7e533
Backport bionic actions CI to sdf8 (#310)
scpeters Jun 30, 2020
2968b25
Fix Actor.cc copy operators and restructure tests (#301)
luca-della-vedova Jul 1, 2020
91b454f
Find python3 in cmake, fix warning (#328)
scpeters Aug 6, 2020
99b7d9f
Changelog for #328
scpeters Aug 6, 2020
7319836
[sdf9] Support nested models in DOM and frame semantics (#316)
scpeters Aug 17, 2020
436a848
bump to 9.3.0~pre1 (#337)
scpeters Aug 17, 2020
d800d1c
Fix Actor.cc copy operators and restructure tests (#301)
luca-della-vedova Jul 1, 2020
8388f27
Support implicit nested canonical links (#341)
scpeters Sep 2, 2020
e9939a5
Store material file path information (#349)
nkoenig Sep 3, 2020
91a0bd8
Store material file path information (#349)
nkoenig Sep 3, 2020
fb50d22
Find python3 in cmake, fix warning (#328)
scpeters Aug 6, 2020
c62d8a3
Add collection labeler (#347) (#362)
chapulina Sep 7, 2020
be2b10d
Add collection labeler (#347) (#363)
chapulina Sep 7, 2020
94055d1
SearchForStuff: add logic to find urdfdom without pkg-config (#245)
traversaro Sep 7, 2020
e27010b
Changelog for 9.3.0 release (#368)
scpeters Sep 7, 2020
246d978
⬆️ 8.9.0 (#361)
chapulina Sep 8, 2020
7819366
Define PATH_MAX for Debian Hurd system (#369)
j-rivero Sep 9, 2020
b6c761b
Changelog for 8.9.0 (#361)
chapulina Sep 8, 2020
2917733
Fix supported shader types (normal_map_X_space) (#383)
chapulina Oct 9, 2020
dd7ce2e
Fix supported shader types (normal_map_X_space) (#383)
chapulina Oct 9, 2020
6094b9d
Make labeler work with PRs from forks (#390)
chapulina Oct 15, 2020
f9c31c9
Move list of debian dependencies to packages.apt (#392)
chapulina Oct 21, 2020
d619e0a
Move list of debian dependencies to packages.apt (#392)
chapulina Oct 21, 2020
0d47aeb
Enable tests for #202 on macOS with Xcode 12+, add catalina workflow …
scpeters Nov 8, 2020
0e77816
Enable tests for #202 on macOS with Xcode 12+, add catalina workflow …
scpeters Nov 8, 2020
8cef85f
Test included model folders missing model.config (#422)
scpeters Nov 23, 2020
f5c8bd9
Prefix nested model names when flattening (#399)
scpeters Oct 30, 2020
a0d4807
Add Sky DOM (#397) (#417)
iche033 Nov 25, 2020
9995007
Decrease far clip lower bound (#435)
nkoenig Dec 14, 2020
940eb3b
Re-disable tests for #202, since they are broken (#438)
scpeters Dec 15, 2020
4805742
Add <double_sided> to material spec (#410)
iche033 Nov 17, 2020
66d934f
Update Migration guide
scpeters Nov 25, 2020
48eb0ed
Merge branch 'sdf8' into sdf9
scpeters Dec 22, 2020
0bca996
Merge pull request #445 from scpeters/merge89
scpeters Dec 23, 2020
32d96a6
Add Heightmap class (#388)
chapulina Jan 5, 2021
7abf3fb
9 ➡️ 10
chapulina Jan 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/sdf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set (headers
Frame.hh
Geometry.hh
Gui.hh
Heightmap.hh
Imu.hh
Joint.hh
JointAxis.hh
Expand Down
15 changes: 15 additions & 0 deletions include/sdf/Geometry.hh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace sdf
class GeometryPrivate;
class Box;
class Cylinder;
class Heightmap;
class Mesh;
class Plane;
class Sphere;
Expand All @@ -56,6 +57,9 @@ namespace sdf

/// \brief A mesh geometry.
MESH = 5,

/// \brief A heightmap geometry.
HEIGHTMAP = 6,
};

/// \brief Geometry provides access to a shape, such as a Box. Use the
Expand Down Expand Up @@ -159,6 +163,17 @@ namespace sdf
/// \param[in] _mesh The mesh shape.
public: void SetMeshShape(const Mesh &_mesh);

/// \brief Get the heightmap geometry, or nullptr if the contained geometry
/// is not a heightmap.
/// \return Pointer to the heightmap geometry, or nullptr if the geometry is
/// not a heightmap.
/// \sa GeometryType Type() const
public: const Heightmap *HeightmapShape() const;

/// \brief Set the heightmap shape.
/// \param[in] _heightmap The heightmap shape.
public: void SetHeightmapShape(const Heightmap &_heightmap);

/// \brief Get a pointer to the SDF element that was used during
/// load.
/// \return SDF element pointer. The value will be nullptr if Load has
Expand Down
291 changes: 291 additions & 0 deletions include/sdf/Heightmap.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
/*
* Copyright 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef SDF_HEIGHTMAP_HH_
#define SDF_HEIGHTMAP_HH_

#include <string>
#include <ignition/math/Vector3.hh>
#include <sdf/Element.hh>
#include <sdf/Error.hh>
#include <sdf/sdf_config.h>

namespace sdf
{
// Inline bracket to help doxygen filtering.
inline namespace SDF_VERSION_NAMESPACE {
//

// Forward declare private data class.
class HeightmapPrivate;
class HeightmapTexturePrivate;
class HeightmapBlendPrivate;

/// \brief Texture to be used on heightmaps.
class SDFORMAT_VISIBLE HeightmapTexture
{
/// \brief Constructor
public: HeightmapTexture();

/// \brief Copy constructor
/// \param[in] _texture HeightmapTexture to copy.
public: HeightmapTexture(const HeightmapTexture &_texture);

/// \brief Move constructor
/// \param[in] _texture HeightmapTexture to move.
public: HeightmapTexture(HeightmapTexture &&_texture) noexcept;

/// \brief Destructor
public: virtual ~HeightmapTexture();

/// \brief Move assignment operator.
/// \param[in] _texture Heightmap texture to move.
/// \return Reference to this.
public: HeightmapTexture &operator=(HeightmapTexture &&_texture);

/// \brief Copy Assignment operator.
/// \param[in] _texture The heightmap texture to set values from.
/// \return *this
public: HeightmapTexture &operator=(const HeightmapTexture &_texture);

/// \brief Load the heightmap texture geometry based on a element pointer.
/// This is *not* the usual entry point. Typical usage of the SDF DOM is
/// through the Root object.
/// \param[in] _sdf The SDF Element pointer
/// \return Errors, which is a vector of Error objects. Each Error includes
/// an error code and message. An empty vector indicates no error.
public: Errors Load(ElementPtr _sdf);

/// \brief Get the heightmap texture's size.
/// \return The size of the heightmap texture in meters.
public: double Size() const;

/// \brief Set the size of the texture in meters.
/// \param[in] _uri The size of the texture in meters.
public: void SetSize(double _uri);

/// \brief Get the heightmap texture's diffuse map.
/// \return The diffuse map of the heightmap texture.
public: std::string Diffuse() const;

/// \brief Set the filename of the diffuse map.
/// \param[in] _diffuse The diffuse map of the heightmap texture.
public: void SetDiffuse(const std::string &_diffuse);

/// \brief Get the heightmap texture's normal map.
/// \return The normal map of the heightmap texture.
public: std::string Normal() const;

/// \brief Set the filename of the normal map.
/// \param[in] _normal The normal map of the heightmap texture.
public: void SetNormal(const std::string &_normal);

/// \brief Get a pointer to the SDF element that was used during load.
/// \return SDF element pointer. The value will be nullptr if Load has
/// not been called.
public: sdf::ElementPtr Element() const;

/// \brief Private data pointer.
private: HeightmapTexturePrivate *dataPtr;
};

/// \brief Blend information to be used between textures on heightmaps.
class SDFORMAT_VISIBLE HeightmapBlend
{
/// \brief Constructor
public: HeightmapBlend();

/// \brief Copy constructor
/// \param[in] _blend HeightmapBlend to copy.
public: HeightmapBlend(const HeightmapBlend &_blend);

/// \brief Move constructor
/// \param[in] _blend HeightmapBlend to move.
public: HeightmapBlend(HeightmapBlend &&_blend) noexcept;

/// \brief Destructor
public: virtual ~HeightmapBlend();

/// \brief Move assignment operator.
/// \param[in] _blend Heightmap blend to move.
/// \return Reference to this.
public: HeightmapBlend &operator=(HeightmapBlend &&_blend);

/// \brief Copy Assignment operator.
/// \param[in] _blend The heightmap blend to set values from.
/// \return *this
public: HeightmapBlend &operator=(const HeightmapBlend &_blend);

/// \brief Load the heightmap blend geometry based on a element pointer.
/// This is *not* the usual entry point. Typical usage of the SDF DOM is
/// through the Root object.
/// \param[in] _sdf The SDF Element pointer
/// \return Errors, which is a vector of Error objects. Each Error includes
/// an error code and message. An empty vector indicates no error.
public: Errors Load(ElementPtr _sdf);

/// \brief Get the heightmap blend's minimum height.
/// \return The minimum height of the blend layer.
public: double MinHeight() const;

/// \brief Set the minimum height of the blend in meters.
/// \param[in] _uri The minimum height of the blend in meters.
public: void SetMinHeight(double _minHeight);

/// \brief Get the heightmap blend's fade distance.
/// \return The fade distance of the heightmap blend in meters.
public: double FadeDistance() const;

/// \brief Set the distance over which the blend occurs.
/// \param[in] _uri The distance in meters.
public: void SetFadeDistance(double _fadeDistance);

/// \brief Get a pointer to the SDF element that was used during load.
/// \return SDF element pointer. The value will be nullptr if Load has
/// not been called.
public: sdf::ElementPtr Element() const;

/// \brief Private data pointer.
private: HeightmapBlendPrivate *dataPtr;
};

/// \brief Heightmap represents a shape defined by a 2D field, and is usually
/// accessed through a Geometry.
class SDFORMAT_VISIBLE Heightmap
{
/// \brief Constructor
public: Heightmap();

/// \brief Copy constructor
/// \param[in] _heightmap Heightmap to copy.
public: Heightmap(const Heightmap &_heightmap);

/// \brief Move constructor
/// \param[in] _heightmap Heightmap to move.
public: Heightmap(Heightmap &&_heightmap) noexcept;

/// \brief Destructor
public: virtual ~Heightmap();

/// \brief Move assignment operator.
/// \param[in] _heightmap Heightmap to move.
/// \return Reference to this.
public: Heightmap &operator=(Heightmap &&_heightmap);

/// \brief Copy Assignment operator.
/// \param[in] _heightmap The heightmap to set values from.
/// \return *this
public: Heightmap &operator=(const Heightmap &_heightmap);

/// \brief Load the heightmap geometry based on a element pointer.
/// This is *not* the usual entry point. Typical usage of the SDF DOM is
/// through the Root object.
/// \param[in] _sdf The SDF Element pointer
/// \return Errors, which is a vector of Error objects. Each Error includes
/// an error code and message. An empty vector indicates no error.
public: Errors Load(ElementPtr _sdf);

/// \brief Get the heightmap's URI.
/// \return The URI of the heightmap data.
public: std::string Uri() const;

/// \brief Set the URI to a grayscale image.
/// \param[in] _uri The URI of the heightmap.
public: void SetUri(const std::string &_uri);

/// \brief The path to the file where this element was loaded from.
/// \return Full path to the file on disk.
public: const std::string &FilePath() const;

/// \brief Set the path to the file where this element was loaded from.
/// \paramp[in] _filePath Full path to the file on disk.
public: void SetFilePath(const std::string &_filePath);

/// \brief Get the heightmap's scaling factor.
/// \return The heightmap's size.
public: ignition::math::Vector3d Size() const;

/// \brief Set the heightmap's scaling factor. Defaults to 1x1x1.
/// \return The heightmap's size factor.
public: void SetSize(const ignition::math::Vector3d &_size);

/// \brief Get the heightmap's position offset.
/// \return The heightmap's position offset.
public: ignition::math::Vector3d Position() const;

/// \brief Set the heightmap's position offset.
/// \return The heightmap's position offset.
public: void SetPosition(const ignition::math::Vector3d &_position);

/// \brief Get whether the heightmap uses terrain paging.
/// \return True if the heightmap uses terrain paging.
public: bool UseTerrainPaging() const;

/// \brief Set whether the heightmap uses terrain paging. Defaults to false.
/// \param[in] _use True to use.
public: void SetUseTerrainPaging(bool _use);

/// \brief Get the heightmap's sampling per datum.
/// \return The heightmap's sampling.
public: unsigned int Sampling() const;

/// \brief Set the heightmap's sampling. Defaults to 2.
/// \param[in] _sampling The heightmap's sampling per datum.
public: void SetSampling(unsigned int _sampling);

/// \brief Get the number of heightmap textures.
/// \return Number of heightmap textures contained in this Heightmap object.
public: uint64_t TextureCount() const;

/// \brief Get a heightmap texture based on an index.
/// \param[in] _index Index of the heightmap texture. The index should be in
/// the range [0..TextureCount()).
/// \return Pointer to the heightmap texture. Nullptr if the index does not
/// exist.
/// \sa uint64_t TextureCount() const
public: const HeightmapTexture *TextureByIndex(uint64_t _index) const;

/// \brief Add a heightmap texture.
/// \param[in] _texture Texture to add.
public: void AddTexture(const HeightmapTexture &_texture);

/// \brief Get the number of heightmap blends.
/// \return Number of heightmap blends contained in this Heightmap object.
public: uint64_t BlendCount() const;

/// \brief Get a heightmap blend based on an index.
/// \param[in] _index Index of the heightmap blend. The index should be in
/// the range [0..BlendCount()).
/// \return Pointer to the heightmap blend. Nullptr if the index does not
/// exist.
/// \sa uint64_t BlendCount() const
public: const HeightmapBlend *BlendByIndex(uint64_t _index) const;

/// \brief Add a heightmap blend.
/// \param[in] _blend Blend to add.
public: void AddBlend(const HeightmapBlend &_blend);

/// \brief Get a pointer to the SDF element that was used during load.
/// \return SDF element pointer. The value will be nullptr if Load has
/// not been called.
public: sdf::ElementPtr Element() const;

/// \brief Private data pointer.
private: HeightmapPrivate *dataPtr;
};
}
}
#endif
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ set (sources
Filesystem.cc
Geometry.cc
Gui.cc
Heightmap.cc
ign.cc
Imu.cc
Joint.cc
Expand Down Expand Up @@ -96,6 +97,7 @@ if (BUILD_SDF_TEST)
Filesystem_TEST.cc
Geometry_TEST.cc
Gui_TEST.cc
Heightmap_TEST.cc
Imu_TEST.cc
Joint_TEST.cc
JointAxis_TEST.cc
Expand Down
Loading