Skip to content

Commit

Permalink
Enable ogre2 heightmap test (#670)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 authored Jul 23, 2022
1 parent 064e808 commit 7e6e45c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
5 changes: 5 additions & 0 deletions ogre2/include/ignition/rendering/ogre2/Ogre2Heightmap.hh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ namespace ignition
/// \param[in] _activeCamera Camera about to be used for rendering
public: void UpdateForRender(Ogre::Camera *_activeCamera);

// Documentation inherited.
// \todo(iche033) rename this to Destroy and
// make this function public and virtual
private: void DestroyImpl();

/// \brief Heightmap should only be created by scene.
private: friend class OgreScene;

Expand Down
7 changes: 7 additions & 0 deletions ogre2/src/Ogre2Heightmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ Ogre2Heightmap::Ogre2Heightmap(const HeightmapDescriptor &_desc)
//////////////////////////////////////////////////
Ogre2Heightmap::~Ogre2Heightmap()
{
this->DestroyImpl();
}

//////////////////////////////////////////////////
void Ogre2Heightmap::DestroyImpl()
{
this->dataPtr->terra.reset();
}

//////////////////////////////////////////////////
Expand Down
18 changes: 9 additions & 9 deletions src/Heightmap_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ class HeightmapTest : public testing::Test,
TEST_P(HeightmapTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(Heightmap))
{
std::string renderEngine{this->GetParam()};
if (renderEngine != "ogre")
{
igndbg << "Heightmap not supported yet in rendering engine: "
<< renderEngine << std::endl;
return;
}

auto engine = rendering::engine(renderEngine);
if (!engine)
Expand Down Expand Up @@ -159,6 +153,14 @@ TEST_P(HeightmapTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(Heightmap))

scene->RootVisual()->AddChild(vis);

// \todo(iche033) this should not be needed once Ogre2Heightmap::Destroy is
// implemented.
if (renderEngine == "ogre2")
{
vis->Destroy();
heightmap.reset();
}

// Clean up
engine->DestroyScene(scene);
rendering::unloadEngine(engine->Name());
Expand Down Expand Up @@ -351,10 +353,8 @@ TEST_P(HeightmapTest, CopyAssignmentAfterMove)
EXPECT_DOUBLE_EQ(123.456, blend2.MinHeight());
}

// TODO(anyone) Running test with Ogre1. Update once Ogre2 is supported.
// https://github.com/ignitionrobotics/ign-rendering/issues/187
INSTANTIATE_TEST_CASE_P(Heightmap, HeightmapTest,
::testing::ValuesIn({"ogre"}),
RENDER_ENGINE_VALUES,
ignition::rendering::PrintToStringParam());

/////////////////////////////////////////////////
Expand Down

0 comments on commit 7e6e45c

Please sign in to comment.