Skip to content

Commit

Permalink
Reduce default heightmap sampling from 2 to 1 (#459)
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <louise@openrobotics.org>
  • Loading branch information
chapulina committed Jan 26, 2021
1 parent a721bba commit 54a69c5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ but with improved human-readability..
+ bool JointNameExists(const std::string &) const
+ bool LinkNameExists(const std::string &) const

1. **sdf/Heightmap.hh**: sampling now defaults to 1 instead of 2.

### Deprecations

1. **src/Root.hh**: The following methods have been deprecated in favor of the
Expand Down Expand Up @@ -308,6 +310,8 @@ but with improved human-readability..
1. **joint.sdf** `child` and `parent` elements accept frame names instead of only link names
* [Issue 204](https://github.com/osrf/sdformat/issues/204)

1. **heightmap.sdf**: sampling now defaults to 1 instead of 2.

### Deprecations

1. **joint.sdf** `initial_position` element in `<joint><axis>` and `<joint><axis2>` is deprecated
Expand Down
2 changes: 1 addition & 1 deletion include/sdf/Heightmap.hh
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ namespace sdf
/// \return The heightmap's sampling.
public: unsigned int Sampling() const;

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

Expand Down
4 changes: 2 additions & 2 deletions sdf/1.8/heightmap_shape.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
<element name="use_terrain_paging" type="bool" default="false" required="0">
<description>Set if the rendering engine will use terrain paging</description>
</element>
<element name="sampling" type="unsigned int" default="2" required="0">
<description>Samples per heightmap datum. For rasterized heightmaps, this indicates the number of samples to take per pixel. Using a lower value, e.g. 1, will generally improve the performance of the heightmap but lower the heightmap quality.
<element name="sampling" type="unsigned int" default="1" required="0">
<description>Samples per heightmap datum. For rasterized heightmaps, this indicates the number of samples to take per pixel. Using a higher value, e.g. 2, will generally improve the quality of the heightmap but lower performance.
</description>
</element>
</element>
2 changes: 1 addition & 1 deletion src/Heightmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class sdf::HeightmapPrivate
public: bool useTerrainPaging{false};

/// \brief Sampling per datum.
public: unsigned int sampling{2u};
public: unsigned int sampling{1u};

/// \brief Textures in order
public: std::vector<HeightmapTexture> textures;
Expand Down
4 changes: 2 additions & 2 deletions src/Heightmap_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TEST(DOMHeightmap, Construction)
EXPECT_EQ(ignition::math::Vector3d(1, 1, 1), heightmap.Size());
EXPECT_EQ(ignition::math::Vector3d::Zero, heightmap.Position());
EXPECT_FALSE(heightmap.UseTerrainPaging());
EXPECT_EQ(2u, heightmap.Sampling());
EXPECT_EQ(1u, heightmap.Sampling());
EXPECT_EQ(0u, heightmap.TextureCount());
EXPECT_EQ(0u, heightmap.BlendCount());
EXPECT_EQ(nullptr, heightmap.TextureByIndex(0u));
Expand Down Expand Up @@ -304,7 +304,7 @@ TEST(DOMHeightmap, Set)
heightmap.SetUseTerrainPaging(true);
EXPECT_TRUE(heightmap.UseTerrainPaging());

EXPECT_EQ(2u, heightmap.Sampling());
EXPECT_EQ(1u, heightmap.Sampling());
heightmap.SetSampling(12u);
EXPECT_EQ(12u, heightmap.Sampling());

Expand Down

0 comments on commit 54a69c5

Please sign in to comment.