#include <bbwxvtkViewer3D.h>
Public Member Functions | |
Viewer3DWidget (Viewer3D *box, wxWindow *parent, bool stereo) | |
~Viewer3DWidget () | |
void | Update () |
vtkRenderer * | GetRenderer () |
wxVTKRenderWindowInteractor * | GetInteractor () |
virtual void | Refresh (bool eraseBackground=true, const wxRect *rect=NULL) |
Private Attributes | |
Viewer3D * | mBox |
vtkRenderer * | renderer |
vtkRenderWindow * | renderwindow |
vtkInteractorStyleTrackballCamera * | interactorstyle |
wxVTKRenderWindowInteractor * | wxvtkrenderwindowinteractor |
Definition at line 54 of file bbwxvtkViewer3D.h.
bbwxvtk::Viewer3DWidget::Viewer3DWidget | ( | Viewer3D * | box, | |
wxWindow * | parent, | |||
bool | stereo | |||
) |
Definition at line 39 of file bbwxvtkViewer3D.cxx.
References interactorstyle, renderer, renderwindow, and wxvtkrenderwindowinteractor.
00040 : 00041 wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL), 00042 mBox(box) 00043 { 00044 wxPanel *panel = this; 00045 00046 wxvtkrenderwindowinteractor = new wxVTKRenderWindowInteractor(panel,-1); 00047 wxvtkrenderwindowinteractor->UseCaptureMouseOn(); 00048 00049 renderer = vtkRenderer::New(); 00050 renderwindow = vtkRenderWindow::New(); 00051 00052 renderwindow->AddRenderer(renderer); 00053 00054 if (stereo==true){ 00055 renderwindow->SetStereoCapableWindow(1); 00056 //renderwindow->SetStereoTypeToCrystalEyes(); 00057 renderwindow->SetStereoTypeToRedBlue(); 00058 renderwindow->SetStereoRender(1); 00059 } 00060 00061 wxvtkrenderwindowinteractor->SetRenderWindow(renderwindow); 00062 00063 interactorstyle = vtkInteractorStyleTrackballCamera ::New(); 00064 interactorstyle->SetInteractor ( wxvtkrenderwindowinteractor ); 00065 wxvtkrenderwindowinteractor->SetInteractorStyle( interactorstyle ); 00066 00067 int x1=0,x2=200,y1=0,y2=200,z1=0,z2=200; 00068 double spx=1,spy=1,spz=1; 00069 vtkCamera *camera = renderer->GetActiveCamera(); 00070 camera->SetViewUp ( spx*0, -spy*1, spz*0); 00071 camera->SetPosition( spx*(x1+x2)/2, spy*(y1+y2)/2, -spz*10000000); 00072 camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0); 00073 // camera->SetParallelScale( spx*(x2-x1)/2.0 ); 00074 renderer->ResetCamera(x1,x2,y1,y2,z1,z2); 00075 00076 renderer->SetBackground(0.1, 0.1, 0.2); 00077 00078 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 00079 sizer->Add( wxvtkrenderwindowinteractor , 1, wxEXPAND, 0); 00080 panel->SetSizer(sizer); 00081 panel->SetAutoLayout(true); 00082 panel->Layout(); 00083 00084 }
bbwxvtk::Viewer3DWidget::~Viewer3DWidget | ( | ) |
Definition at line 88 of file bbwxvtkViewer3D.cxx.
References interactorstyle, renderer, renderwindow, and wxvtkrenderwindowinteractor.
00089 { 00090 renderwindow->Delete(); 00091 renderer->Delete(); 00092 interactorstyle->Delete(); 00093 delete wxvtkrenderwindowinteractor; 00094 }
void bbwxvtk::Viewer3DWidget::Update | ( | ) |
Definition at line 98 of file bbwxvtkViewer3D.cxx.
References bbwxvtk::wxVTKRenderWindowInteractor::Render(), renderer, and wxvtkrenderwindowinteractor.
Referenced by bbwxvtk::Viewer3D::CreateWidget().
00099 { 00100 wxvtkrenderwindowinteractor->Update(); 00101 wxvtkrenderwindowinteractor->Render(); 00102 renderer->ResetCameraClippingRange(); 00103 }
vtkRenderer * bbwxvtk::Viewer3DWidget::GetRenderer | ( | ) |
Definition at line 107 of file bbwxvtkViewer3D.cxx.
References renderer.
Referenced by bbwxvtk::Viewer3D::CreateWidget().
00108 { 00109 return renderer; 00110 }
wxVTKRenderWindowInteractor * bbwxvtk::Viewer3DWidget::GetInteractor | ( | ) |
Definition at line 114 of file bbwxvtkViewer3D.cxx.
References wxvtkrenderwindowinteractor.
Referenced by bbwxvtk::Viewer3D::CreateWidget().
00115 { 00116 return wxvtkrenderwindowinteractor; 00117 }
void bbwxvtk::Viewer3DWidget::Refresh | ( | bool | eraseBackground = true , |
|
const wxRect * | rect = NULL | |||
) | [virtual] |
Viewer3D* bbwxvtk::Viewer3DWidget::mBox [private] |
Definition at line 66 of file bbwxvtkViewer3D.h.
vtkRenderer* bbwxvtk::Viewer3DWidget::renderer [private] |
Definition at line 67 of file bbwxvtkViewer3D.h.
Referenced by GetRenderer(), Update(), Viewer3DWidget(), and ~Viewer3DWidget().
vtkRenderWindow* bbwxvtk::Viewer3DWidget::renderwindow [private] |
Definition at line 68 of file bbwxvtkViewer3D.h.
Referenced by Viewer3DWidget(), and ~Viewer3DWidget().
vtkInteractorStyleTrackballCamera* bbwxvtk::Viewer3DWidget::interactorstyle [private] |
Definition at line 69 of file bbwxvtkViewer3D.h.
Referenced by Viewer3DWidget(), and ~Viewer3DWidget().
Definition at line 70 of file bbwxvtkViewer3D.h.
Referenced by GetInteractor(), Update(), Viewer3DWidget(), and ~Viewer3DWidget().