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

Adding option for visibility #133

Merged
merged 1 commit into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions ogre/include/ignition/rendering/ogre/OgreLidarVisual.hh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ namespace ignition
/// \brief Clear data stored by dynamiclines
private: void ClearVisualData();

// Documentation inherited
public: virtual void SetVisible(bool _visible) override;

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

Expand Down
15 changes: 15 additions & 0 deletions ogre/src/OgreLidarVisual.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class ignition::rendering::OgreLidarVisualPrivate

/// \brief True if new points data is received
public: bool receivedData = false;

/// \brief The visibility of the visual
public: bool visible = true;
};

using namespace ignition;
Expand Down Expand Up @@ -482,6 +485,11 @@ void OgreLidarVisual::Update()
}
verticalAngle += this->verticalAngleStep;
}

// The newly created dynamic lines are having default visibility as true.
// The visibility needs to be set as per the current value after the new
// renderables are created.
this->SetVisible(this->dataPtr->visible);
}

//////////////////////////////////////////////////
Expand All @@ -495,3 +503,10 @@ std::vector<double> OgreLidarVisual::Points() const
{
return this->dataPtr->lidarPoints;
}

//////////////////////////////////////////////////
void OgreLidarVisual::SetVisible(bool _visible)
{
this->dataPtr->visible = _visible;
this->ogreNode->setVisible(this->dataPtr->visible);
}
3 changes: 3 additions & 0 deletions ogre2/include/ignition/rendering/ogre2/Ogre2LidarVisual.hh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ namespace ignition
/// \brief Clear data stored by dynamiclines
private: void ClearVisualData();

// Documentation inherited
public: virtual void SetVisible(bool _visible) override;

/// \brief Lidar Visual should only be created by scene.
private: friend class Ogre2Scene;

Expand Down
15 changes: 15 additions & 0 deletions ogre2/src/Ogre2LidarVisual.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ class ignition::rendering::Ogre2LidarVisualPrivate

/// \brief True if new points data is received
public: bool receivedData = false;

/// \brief The visibility of the visual
public: bool visible = true;
};

using namespace ignition;
Expand Down Expand Up @@ -429,6 +432,11 @@ void Ogre2LidarVisual::Update()
}
verticalAngle += this->verticalAngleStep;
}

// The newly created dynamic lines are having default visibility as true.
// The visibility needs to be set as per the current value after the new
// renderables are created.
this->SetVisible(this->dataPtr->visible);
}

//////////////////////////////////////////////////
Expand All @@ -442,3 +450,10 @@ std::vector<double> Ogre2LidarVisual::Points() const
{
return this->dataPtr->lidarPoints;
}

//////////////////////////////////////////////////
void Ogre2LidarVisual::SetVisible(bool _visible)
{
this->dataPtr->visible = _visible;
this->ogreNode->setVisible(this->dataPtr->visible);
}