From 25a57ea6b6c0cad9dc3da2866f121c3a15470035 Mon Sep 17 00:00:00 2001 From: Ricardo A Corredor Date: Fri, 15 Feb 2013 12:26:30 +0100 Subject: [PATCH] Changes to define the background color of the Viewer3D --- packages/wxvtk/src/bbwxvtkViewer3D.cxx | 9 ++++++++- packages/wxvtk/src/bbwxvtkViewer3D.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/wxvtk/src/bbwxvtkViewer3D.cxx b/packages/wxvtk/src/bbwxvtkViewer3D.cxx index 2072894..1d5fd58 100644 --- a/packages/wxvtk/src/bbwxvtkViewer3D.cxx +++ b/packages/wxvtk/src/bbwxvtkViewer3D.cxx @@ -184,6 +184,11 @@ void Viewer3DWidget::Refresh(bool eraseBackground , const wxRect* rect ) bbSetOutputRenderer( NULL ); bbSetOutputInteractor( NULL ); bbSetOutputWidget(NULL); + std::vector bckgrndColor(3); + bckgrndColor[0] = 0.1; + bckgrndColor[1] = 0.1; + bckgrndColor[2] = 0.2; + bbSetInputBackgroundColor(bckgrndColor); } //----------------------------------------------------------------- @@ -247,7 +252,7 @@ void Viewer3DWidget::Refresh(bool eraseBackground , const wxRect* rect ) // Viewer3DWidget* w = (Viewer3DWidget*)bbGetOutputWidget(); // if (w) w->Update(); - + Viewer3DWidget* w = (Viewer3DWidget*)bbGetOutputWidget(); if ((firsttime==true) && (w!=NULL)){ @@ -288,6 +293,8 @@ void Viewer3DWidget::Refresh(bool eraseBackground , const wxRect* rect ) vtkRenderer *renderer = w->GetRenderer(); if (renderer!=NULL) { + std::vector bckgrndColor = bbGetInputBackgroundColor(); + renderer->SetBackground(bckgrndColor[0], bckgrndColor[1], bckgrndColor[2]); bbSetOutputRenderer( renderer ); /*if (bbGetInputIn1()!=NULL) {renderer->AddActor( bbGetInputIn1() ); } diff --git a/packages/wxvtk/src/bbwxvtkViewer3D.h b/packages/wxvtk/src/bbwxvtkViewer3D.h index b3fb40f..25dc712 100644 --- a/packages/wxvtk/src/bbwxvtkViewer3D.h +++ b/packages/wxvtk/src/bbwxvtkViewer3D.h @@ -107,6 +107,7 @@ namespace bbwxvtk BBTK_DECLARE_INPUT(Obs4, vtkInteractorObserver *); BBTK_DECLARE_INPUT(Obs5, vtkInteractorObserver *); BBTK_DECLARE_INPUT(Stereo, bool); + BBTK_DECLARE_INPUT(BackgroundColor,std::vector); BBTK_DECLARE_OUTPUT(Renderer,vtkRenderer*); BBTK_DECLARE_OUTPUT(Interactor,wxVTKRenderWindowInteractor*); BBTK_PROCESS(Process); @@ -130,6 +131,7 @@ namespace bbwxvtk BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr"); BBTK_DESCRIPTION("3D Viewer widget (vtk)"); BBTK_CATEGORY("viewer"); + BBTK_INPUT(Viewer3D,BackgroundColor,"Render background's color",std::vector,""); BBTK_INPUT(Viewer3D,In1,"Input actor",vtkProp3D *,""); BBTK_INPUT(Viewer3D,In2,"Input actor",vtkProp3D *,""); BBTK_INPUT(Viewer3D,In3,"Input actor",vtkProp3D *,""); -- 2.47.1