X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fvtk%2Fsrc%2FbbvtkPolyDataToActor.cxx;h=2aad2ec130eb57e7ee73ab1be1e5634a342df18a;hb=5ab6a1678119cdff10db5524a400a0ecc3c53580;hp=0a2fdfdb24074331ed862707a18e2c28901bfb3b;hpb=ce796ef8e6c470b95b8f00cad76c25a9e4a88df1;p=bbtk.git diff --git a/packages/vtk/src/bbvtkPolyDataToActor.cxx b/packages/vtk/src/bbvtkPolyDataToActor.cxx index 0a2fdfd..2aad2ec 100644 --- a/packages/vtk/src/bbvtkPolyDataToActor.cxx +++ b/packages/vtk/src/bbvtkPolyDataToActor.cxx @@ -43,10 +43,13 @@ #include "vtkProperty.h" #include "vtkLinearTransform.h" +#include "vtkCleanPolyData.h" #include "bbvtkPolyDataToActor.h" #include "bbvtkPackage.h" +#include "vtkRenderWindow.h" + namespace bbvtk { BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,PolyDataToActor) @@ -60,7 +63,6 @@ namespace bbvtk colour.push_back(1.0); colour.push_back(0.5); bbSetInputColour(colour); - bbSetInputActive(true); bbSetInputIn(NULL); bbSetInputRenderer(NULL); @@ -69,7 +71,6 @@ namespace bbvtk bbSetInputRepresentation(2); bbSetInputLineWidth(1); bbSetInputScalarVisibility(false); - polydatamapper = NULL; vtkactor = NULL; } @@ -84,7 +85,7 @@ namespace bbvtk // polydatamapper->SetInput(marchingcubes->GetOutput()); vtkactor->SetMapper(polydatamapper); - polydatamapper->ImmediateModeRenderingOn(); +// polydatamapper->ImmediateModeRenderingOn(); } //--------------------------------------------------------------------- @@ -105,19 +106,62 @@ namespace bbvtk //--------------------------------------------------------------------- - void PolyDataToActor::DoProcess() - { +void PolyDataToActor::DoProcess() +{ +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); +//https://stackoverflow.com/questions/47528086/problems-with-rendering-transparent-objects-in-vtk +//https://itk.org/Wiki/VTK/Depth_Peeling +bbGetInputRenderer()->SetUseDepthPeeling(1); +bbGetInputRenderer()->SetOcclusionRatio(0.1); +bbGetInputRenderer()->SetMaximumNumberOfPeels(100); +bbGetInputRenderer()->GetRenderWindow()->SetMultiSamples(0); +bbGetInputRenderer()->GetRenderWindow()->SetAlphaBitPlanes(1); + + + if (bbGetInputRenderer()==NULL) + { + printf("EED Warnning! PolyDataToActor::DoProcess missing Renderer.\n"); + } + if (bbGetInputActive()==true) { + + //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 polydatamapper->SetInput( bbGetInputIn() ); #else - polydatamapper->SetInputData( bbGetInputIn() ); + polydatamapper->SetInputData( bbGetInputIn() ); #endif vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() ); + + if (bbGetInputRepresentation()==0) + { + vtkactor->GetProperty()->SetAmbient(1); + vtkactor->GetProperty()->SetDiffuse(1); + vtkactor->GetProperty()->SetSpecular(0); +printf("EED WARNNING! PolyDataToActor::DoProcess which is the default values of Ambient, Diffuse, Specular for points option? \n"); + } else if (bbGetInputRepresentation()==1) + { + vtkactor->GetProperty()->SetAmbient(1); + vtkactor->GetProperty()->SetDiffuse(1); + vtkactor->GetProperty()->SetSpecular(0); + } else if (bbGetInputRepresentation()==2) + { + vtkactor->GetProperty()->SetAmbient(0); + vtkactor->GetProperty()->SetDiffuse(1); + vtkactor->GetProperty()->SetSpecular(0); + } + vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() ); vtkactor->GetProperty()->SetColor( bbGetInputColour()[0], @@ -125,6 +169,7 @@ namespace bbvtk bbGetInputColour()[2] ); vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() ); + if ( bbGetInputTransform()!=NULL ) { @@ -154,7 +199,7 @@ namespace bbvtk bbGetInputRenderer()->RemoveActor( vtkactor ); } // actorAdded } // Active - } +}