]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx
Clean code
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxVtk3DBaseView.cxx
index 334104671c35e4cb36e97ff588fc8a3098ea9d4b..4bf3d9b73a7520f050ab99e131f2f6eaa642663b 100644 (file)
@@ -42,7 +42,6 @@ wxVtk3DBaseView::wxVtk3DBaseView(wxWindow *parent, vtkBaseData* vtkbasedata)
 //-------------------------------------------------------------------
 wxVtk3DBaseView::~wxVtk3DBaseView()
 {
-
        if (_aCamera!=NULL)             { _aCamera              -> Delete(); _aCamera=NULL;}
        if (_aRenderer!=NULL)   { _aRenderer    -> Delete(); _aRenderer=NULL;}
        if (_renWin!=NULL)              
@@ -81,16 +80,12 @@ void wxVtk3DBaseView::Refresh()
 // EED 27/05/2013
 void wxVtk3DBaseView::ResetCamera(int* ext, double* spc)
 {
-
-      GetRenderer()->ResetCameraClippingRange();
-
+    GetRenderer()->ResetCameraClippingRange();
        if(ext == NULL)
        {
-
                GetRenderer()->ResetCamera ();
                GetCamera()->Dolly(1.2);
-       }else{
-               
+       }else{  
                /*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0));
                double y = (spc[1])*(origin[1]+(double)ext[3]);
                double z = (spc[2])*(origin[2]+(((double)ext[5]-(double)ext[4])/2.0));*/
@@ -100,25 +95,22 @@ void wxVtk3DBaseView::ResetCamera(int* ext, double* spc)
                double y1=(spc[1])*((double)ext[3]+origin[1]);
                double z0=(spc[2])*((double)ext[4]+origin[2]);
                double z1=(spc[2])*((double)ext[5]+origin[2]);*/
-               
                double x0=(spc[0])*((double)ext[0]);
                double x1=(spc[0])*((double)ext[1]);
                double y0=(spc[1])*((double)ext[2]);
                double y1=(spc[1])*((double)ext[3]);
                double z0=(spc[2])*((double)ext[4]);
                double z1=(spc[2])*((double)ext[5]);
-
                GetRenderer()->ResetCamera(x0,x1,y0,y1,z0,z1);
                //_wxvtk3Dbaseview->GetCamera()->SetPosition(x,y,z);
                GetCamera()->Dolly(1.5);        
-       }       
+       }// if ext
 }
 
 //-------------------------------------------------------------------
 void wxVtk3DBaseView::SetStereo(int type)
 {
        //EED 02/06/2012  
-       
        if (_renWin!=NULL)
        {
                if (type==0)
@@ -139,7 +131,6 @@ void wxVtk3DBaseView::SetStereo(int type)
                        // VTK_STEREO_ANAGLYPH     7
                        // VTK_STEREO_CHECKERBOARD 8            
                        _renWin->SetStereoType(type);      
-               
                } // if type
        } // _renWin
 }
@@ -217,7 +208,14 @@ void wxVtk3DBaseView::Configure()
                GetCamera()->Yaw(180+30);
                GetCamera()->Pitch(-22);
                                
-       }
+               //https://stackoverflow.com/questions/47528086/problems-with-rendering-transparent-objects-in-vtk
+               //https://itk.org/Wiki/VTK/Depth_Peeling
+               _aRenderer->SetUseDepthPeeling(1);
+               _aRenderer->SetOcclusionRatio(0.1);
+               _aRenderer->SetMaximumNumberOfPeels(100);
+               _renWin->SetMultiSamples(0);
+               _renWin->SetAlphaBitPlanes(1);
+       } // if _configure
 }
 
 //-------------------------------------------------------------------