]> Creatis software - bbtk.git/commitdiff
Changes to define the background color of the Viewer3D
authorRicardo A Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Fri, 15 Feb 2013 11:26:30 +0000 (12:26 +0100)
committerRicardo A Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Fri, 15 Feb 2013 11:26:30 +0000 (12:26 +0100)
packages/wxvtk/src/bbwxvtkViewer3D.cxx
packages/wxvtk/src/bbwxvtkViewer3D.h

index 20728947c3167cc07214b8e0023d06ad8295fc32..1d5fd58d97ee02fb2dcc677fd9e62856cfd9c10b 100644 (file)
@@ -184,6 +184,11 @@ void Viewer3DWidget::Refresh(bool eraseBackground , const wxRect* rect )
                bbSetOutputRenderer( NULL );
                bbSetOutputInteractor( NULL );
                bbSetOutputWidget(NULL);
+               std::vector<double> 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<double> bckgrndColor = bbGetInputBackgroundColor();
+                         renderer->SetBackground(bckgrndColor[0], bckgrndColor[1], bckgrndColor[2]);
                          bbSetOutputRenderer( renderer );
                          
                          /*if (bbGetInputIn1()!=NULL) {renderer->AddActor( bbGetInputIn1() ); }
index b3fb40f926307a1b96105cbb12a4cb57c1983dc7..25dc71231fad950babc9d346cc61ea3f70c08de9 100644 (file)
@@ -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<double>);
     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<double>,"");
   BBTK_INPUT(Viewer3D,In1,"Input actor",vtkProp3D *,"");
   BBTK_INPUT(Viewer3D,In2,"Input actor",vtkProp3D *,"");
   BBTK_INPUT(Viewer3D,In3,"Input actor",vtkProp3D *,"");