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

Merge branch 'addVisibilityOption' into 'master'

Add visibility on/off option for rendered object

See merge request !186
parents c880f974 ef32ca1b
No related branches found
No related tags found
No related merge requests found
......@@ -187,4 +187,24 @@ 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
......@@ -2515,6 +2515,10 @@ void testVirtualCoupling()
obj->setCollidingGeometry(collidingGeom);
obj->setVisualGeometry(visualGeom);
auto material = std::make_shared<RenderMaterial>();
//material->setVisibilityOff();
visualGeom->setRenderMaterial(material);
// Add virtual coupling object (with visual, colliding, and physics geometry) in the scene.
scene->addSceneObject(obj);
......
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