+ add method to show parts of a mesh transparent
This commit is contained in:
parent
d57b57d7ba
commit
9ee892eb35
|
@ -1582,6 +1582,32 @@ void ViewProviderMesh::fillHole(unsigned long uFacet)
|
|||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
|
||||
void ViewProviderMesh::setFacetTransparency(const std::vector<float>& facetTransparency)
|
||||
{
|
||||
App::Color c = ShapeColor.getValue();
|
||||
pcShapeMaterial->diffuseColor.setNum(facetTransparency.size());
|
||||
SbColor* cols = pcShapeMaterial->diffuseColor.startEditing();
|
||||
for (std::size_t index = 0; index < facetTransparency.size(); ++index)
|
||||
cols[index].setValue(c.r, c.g, c.b);
|
||||
pcShapeMaterial->diffuseColor.finishEditing();
|
||||
|
||||
pcShapeMaterial->transparency.setNum(facetTransparency.size());
|
||||
float* tran = pcShapeMaterial->transparency.startEditing();
|
||||
for (std::size_t index = 0; index < facetTransparency.size(); ++index)
|
||||
tran[index] = facetTransparency[index];
|
||||
|
||||
pcShapeMaterial->transparency.finishEditing();
|
||||
pcMatBinding->value = SoMaterialBinding::PER_FACE;
|
||||
}
|
||||
|
||||
void ViewProviderMesh::resetFacetTransparency()
|
||||
{
|
||||
pcMatBinding->value = SoMaterialBinding::OVERALL;
|
||||
App::Color c = ShapeColor.getValue();
|
||||
pcShapeMaterial->diffuseColor.setValue(c.r, c.g, c.b);
|
||||
pcShapeMaterial->transparency.setValue(0);
|
||||
}
|
||||
|
||||
void ViewProviderMesh::removeFacets(const std::vector<unsigned long>& facets)
|
||||
{
|
||||
// Get the attached mesh property
|
||||
|
|
|
@ -156,6 +156,9 @@ public:
|
|||
std::vector<unsigned long> getVisibleFacetsAfterZoom(const SbBox2s&, const SbViewportRegion&, SoCamera*) const;
|
||||
std::vector<unsigned long> getVisibleFacets(const SbViewportRegion&, SoCamera*) const;
|
||||
virtual void removeFacets(const std::vector<unsigned long>&);
|
||||
/*! The size of the array must be equal to the number of facets. */
|
||||
void setFacetTransparency(const std::vector<float>&);
|
||||
void resetFacetTransparency();
|
||||
//@}
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue
Block a user