Skip to content
Snippets Groups Projects
Commit 9df74c33 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

ENH: Add option to turn on/off visibility of renderable object

parent c880f974
No related branches found
No related tags found
No related merge requests found
......@@ -187,4 +187,25 @@ RenderMaterial::flatShadingOff()
{
m_flatShading = false;
}
void
RenderMaterial::setVisibilityOff()
{
m_isVisible = false;
m_modified = true;
}
void
RenderMaterial::setVisibilityOn()
{
m_isVisible = true;
m_modified = true;
}
bool
RenderMaterial::getVisibility() const
{
return m_isVisible;
}
}
......@@ -105,6 +105,13 @@ public:
void flatShadingOn();
void flatShadingOff();
///
/// \brief Turn on/off visibility
///
void setVisibilityOff();
void setVisibilityOn();
bool getVisibility() const;
protected:
friend class VTKRenderDelegate;
......@@ -124,8 +131,11 @@ protected:
// Textures
std::vector<std::shared_ptr<Texture>> m_textures; ///< Ordered by Texture::Type
// Visibility
bool m_isVisible = true;
bool m_stateModified = true; ///< Flag for expensive state changes
bool m_modified = true; ///< Flag for any material property changes
bool m_modified = true; ///< Flag for any material property changes
bool m_flatShading = false;
};
}
......
......@@ -231,5 +231,16 @@ VTKRenderDelegate::updateActorProperties()
// Material state is now up to date
material->m_stateModified = false;
if (material->getVisibility())
{
m_actor->VisibilityOn();
return;
}
else
{
m_actor->VisibilityOff();
return;
}
}
} // imstk
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment