Skip to content
Snippets Groups Projects
Commit 839dd17f authored by Sam Horvath's avatar Sam Horvath
Browse files

ENH: Added flat shading to RenderMaterial

parent ca5c1ef5
No related branches found
No related tags found
No related merge requests found
......@@ -175,4 +175,16 @@ RenderMaterial::addTexture(std::shared_ptr<Texture> texture)
}
m_textures[texture->getType()] = texture;
}
void
RenderMaterial::flatShadingOn()
{
m_flatShading = true;
}
void
RenderMaterial::flatShadingOff()
{
m_flatShading = false;
}
}
......@@ -99,6 +99,12 @@ public:
void addTexture(std::shared_ptr<Texture> texture);
std::shared_ptr<Texture> getTexture(Texture::Type type);
///
/// \brief Turn on/off flat shading
///
void flatShadingOn();
void flatShadingOff();
protected:
friend class VTKRenderDelegate;
......@@ -120,6 +126,7 @@ protected:
bool m_stateModified = true; ///< Flag for expensive state changes
bool m_modified = true; ///< Flag for any material property changes
bool m_flatShading = false;
};
}
......
......@@ -213,6 +213,14 @@ VTKRenderDelegate::updateActorProperties()
default:
actorProperty->SetRepresentationToSurface();
actorProperty->SetEdgeVisibility(false);
if (material->m_flatShading)
{
actorProperty->SetInterpolationToFlat();
}
else
{
actorProperty->SetInterpolationToGouraud();
}
break;
}
......
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