X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxVtk3DBaseView.cxx;h=58ba013414d29a90420714c7d02242f92e87cd0f;hb=f050938d3947f6b785289da6d58f8fec2da57421;hp=ffb634b00944cfca2d1c7e567b5e6e2321b70b25;hpb=a4ee3758aa0477f677fb981e2c4d6e29995e8db8;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx index ffb634b..58ba013 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx @@ -2,7 +2,9 @@ #include "vtkInteractorStyleBaseView3D.h" - +#ifdef _DEBUG +#define new DEBUG_NEW +#endif wxVtk3DBaseView::wxVtk3DBaseView(wxWindow *parent) :wxVtkBaseView( parent ) { @@ -14,9 +16,14 @@ wxVtk3DBaseView::wxVtk3DBaseView(wxWindow *parent) //------------------------------------------------------------------- wxVtk3DBaseView::~wxVtk3DBaseView() { - if (_aCamera!=NULL) { _aCamera -> Delete(); } - if (_aRenderer!=NULL) { _aRenderer -> Delete(); } - if (_renWin!=NULL) { _renWin -> Delete(); } + + if (_aCamera!=NULL) { _aCamera -> Delete(); _aCamera=NULL;} + if (_aRenderer!=NULL) { _aRenderer -> Delete(); _aRenderer=NULL;} + if (_renWin!=NULL) { + if(_renWin->GetReferenceCount()==0){ + _renWin -> Delete(); _renWin=NULL; + } + } } //------------------------------------------------------------------- vtkCamera* wxVtk3DBaseView::GetCamera() @@ -40,28 +47,64 @@ void wxVtk3DBaseView::Refresh() vtkRenderWindowInteractor *vri = GetWxVTKRenderWindowInteractor(); vri->vtkRenderWindowInteractor::Render(); } + + +//------------------------------------------------------------------- +void wxVtk3DBaseView::SetStereo(int type) +{ + //EED 02/06/2012 + printf("EED wxVtk3DBaseView::SetStereo start\n"); + + if (_renWin!=NULL) + { + printf("EED wxVtk3DBaseView::SetStereo 2\n"); + if (type==0) + { + _renWin->SetStereoRender(0); // OFF + } else { + _renWin->SetStereoRender(1); // ON + _renWin->SetStereoCapableWindow(1); + _renWin->SetAnaglyphColorMask(4,3); + _renWin->SetAnaglyphColorSaturation(0.65); + + // VTK_STEREO_CRYSTAL_EYES 1 + // VTK_STEREO_RED_BLUE 2 + // VTK_STEREO_INTERLACED 3 + // VTK_STEREO_LEFT 4 + // VTK_STEREO_RIGHT 5 + // VTK_STEREO_DRESDEN 6 + // VTK_STEREO_ANAGLYPH 7 + // VTK_STEREO_CHECKERBOARD 8 + _renWin->SetStereoType(type); + + } // if type + } // _renWin + printf("EED wxVtk3DBaseView::SetStereo end\n"); + +} + + //------------------------------------------------------------------- void wxVtk3DBaseView::Configure() { + printf("EED wxVtk3DBaseView::Configure A\n"); if (_configure==false) { + printf("EED wxVtk3DBaseView::Configure B\n"); _configure=true; //wxVtkBaseView::Configure(); _aRenderer = vtkRenderer::New(); _renWin = vtkRenderWindow::New(); _renWin->AddRenderer(_aRenderer); - -// _renWin->SetStereoCapableWindow(1); -// // //renderwindow->SetStereoTypeToCrystalEyes(); -// _renWin->SetStereoTypeToRedBlue(); -// _renWin->SetStereoRender(1); - + _aRenderer->GradientBackgroundOn(); + _aRenderer->SetBackground( 0.33 , 0.33 , 0.33 ); + _aRenderer->SetBackground2( 0.66 , 0.66 , 0.66 ); + + SetStereo(0); + GetWxVTKRenderWindowInteractor()->SetRenderWindow(_renWin); - -// EED Borrame -// vtkInteractorStyle3DMaracas *interactorStyle3DMaracas = vtkInteractorStyle3DMaracas::New(); vtkInteractorStyleBaseView3D *interactorStyleBaseView3D = vtkInteractorStyleBaseView3D::New(); SetInteractorStyleBaseView( interactorStyleBaseView3D ); @@ -69,12 +112,6 @@ void wxVtk3DBaseView::Configure() GetWxVTKRenderWindowInteractor()->SetInteractorStyle( interactorStyleBaseView3D ); interactorStyleBaseView3D->SetwxVtkBaseView(this); - -/* EED Borrame - vtkInteractorStyleSwitch *iss = dynamic_cast(_iren->GetInteractorStyle()); - iss->SetCurrentStyleToTrackballCamera(); -*/ - // It is convenient to create an initial view of the data. The // FocalPoint and Position form a vector direction. Later on // (ResetCamera() method) this vector is used to position the camera @@ -101,4 +138,5 @@ void wxVtk3DBaseView::GetSpacing(double spc[3]) spc[0]=1; spc[1]=1; spc[2]=1; -} \ No newline at end of file +} +