From: Eduardo DAVILA Date: Thu, 27 Jul 2023 20:50:18 +0000 (+0200) Subject: #3507 BackFace in PolyDataToActor Box X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=8e21d66a76ff9117acc7dbbaec9123c56115ff56;p=bbtk.git #3507 BackFace in PolyDataToActor Box --- diff --git a/packages/vtk/src/bbvtkPolyDataToActor.cxx b/packages/vtk/src/bbvtkPolyDataToActor.cxx index 4a40dcd..b49ff78 100644 --- a/packages/vtk/src/bbvtkPolyDataToActor.cxx +++ b/packages/vtk/src/bbvtkPolyDataToActor.cxx @@ -41,7 +41,6 @@ #ifdef _USE_VTK_ -#include "vtkProperty.h" #include "vtkLinearTransform.h" #include "vtkCleanPolyData.h" #include "vtkFieldData.h" @@ -90,8 +89,10 @@ namespace bbvtk //--------------------------------------------------------------------- void PolyDataToActor::bbUserInitializeProcessing() { - polydatamapper = vtkPolyDataMapper::New(); - vtkactor = vtkActor::New(); + polydatamapper = vtkPolyDataMapper::New(); + vtkactor = vtkActor::New(); + backfaceproperty = vtkProperty::New(); + // polydatamapper->SetInput(marchingcubes->GetOutput()); vtkactor->SetMapper(polydatamapper); @@ -201,10 +202,15 @@ printf("EED WARNNING! PolyDataToActor::DoProcess which is the default values o vtkactor->GetProperty()->SetColor( bbGetInputColour()[0], bbGetInputColour()[1], bbGetInputColour()[2] ); vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() ); - vtkProperty *backfaceproperty = vtkProperty::New(); - backfaceproperty->SetColor(0.5, 0.5, 1); - backfaceproperty->SetOpacity( bbGetInputOpacity() ); - vtkactor->SetBackfaceProperty( backfaceproperty ); +//EED 2023-07-28 + if (bbGetInputBackFaceColour().size()==3) + { + backfaceproperty->SetColor(0.5, 0.5, 1); + backfaceproperty->SetOpacity( bbGetInputOpacity() ); + vtkactor->SetBackfaceProperty( backfaceproperty ); + } else { + vtkactor->SetBackfaceProperty( NULL ); + } if ( bbGetInputTransform()!=NULL ) { diff --git a/packages/vtk/src/bbvtkPolyDataToActor.h b/packages/vtk/src/bbvtkPolyDataToActor.h index b62a3ff..f0c9beb 100644 --- a/packages/vtk/src/bbvtkPolyDataToActor.h +++ b/packages/vtk/src/bbvtkPolyDataToActor.h @@ -62,6 +62,8 @@ #include "vtkProp3D.h" #include "vtkActor.h" #include "vtkScalarsToColors.h" +#include "vtkProperty.h" + #include #include "bbtkAtomicBlackBox.h" @@ -76,13 +78,15 @@ namespace bbvtk bool actorAdded; vtkPolyDataMapper *polydatamapper; vtkActor *vtkactor; - + vtkProperty *backfaceproperty; + BBTK_BLACK_BOX_INTERFACE(PolyDataToActor,bbtk::AtomicBlackBox); BBTK_DECLARE_INPUT(Active,bool); BBTK_DECLARE_INPUT(In,vtkPolyData *); BBTK_DECLARE_INPUT(Opacity,double); BBTK_DECLARE_INPUT(Colour,std::vector); + BBTK_DECLARE_INPUT(BackFaceColour,std::vector); BBTK_DECLARE_INPUT(Renderer,vtkRenderer *); BBTK_DECLARE_INPUT(Transform, vtkLinearTransform *); BBTK_DECLARE_INPUT(Representation, int); @@ -111,6 +115,7 @@ namespace bbvtk BBTK_INPUT(PolyDataToActor,Active,"Active true/false (default true)",bool,""); BBTK_INPUT(PolyDataToActor,Opacity,"Opacity",double,""); BBTK_INPUT(PolyDataToActor,Colour,"r g b",vectorcolour,"colour"); + BBTK_INPUT(PolyDataToActor,BackFaceColour,"(default EMPTY) [r g b] (0..1)",vectorcolour,"colour"); BBTK_INPUT(PolyDataToActor,Renderer,"3D scene in which to insert the surface",vtkRenderer*,""); BBTK_INPUT(PolyDataToActor,Transform,"Linear Transform (4x4 homogeneous)",vtkLinearTransform*,""); BBTK_INPUT(PolyDataToActor,Representation,"0 points,1 wireframe, 2(default) surface",int,"");