]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkLightKit.cxx
3195 creaVtk Feature New Normal - new Boxes ImageCutByAxis LightKit MeshCutByAxis
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkLightKit.cxx
1 //===== 
2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
3 //===== 
4 #include "bbcreaVtkLightKit.h"
5 #include "bbcreaVtkPackage.h"
6
7 //#include <vtkLight.h>
8 #include <vtkLightCollection.h>
9 #include <vtkLightKit.h>
10
11 namespace bbcreaVtk
12 {
13
14 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,LightKit)
15 BBTK_BLACK_BOX_IMPLEMENTATION(LightKit,bbtk::AtomicBlackBox);
16 //===== 
17 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
18 //===== 
19 void LightKit::Process()
20 {
21
22 // THE MAIN PROCESSING METHOD BODY
23 //   Here we simply set the input 'In' value to the output 'Out'
24 //   And print out the output value
25 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
26 //    void bbSet{Input|Output}NAME(const TYPE&)
27 //    const TYPE& bbGet{Input|Output}NAME() const 
28 //    Where :
29 //    * NAME is the name of the input/output
30 //      (the one provided in the attribute 'name' of the tag 'input')
31 //    * TYPE is the C++ type of the input/output
32 //      (the one provided in the attribute 'type' of the tag 'input')
33
34 //    bbSetOutputOut( bbGetInputIn() );
35 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
36   
37         vtkLightCollection* originalLights = bbGetInputRenderer()->GetLights();
38         std::cout << "Now there are " << originalLights->GetNumberOfItems() << " lights." << std::endl;
39
40         if (firsttime==true)
41         {
42                 firsttime=false;
43                 bbGetInputRenderer()->RemoveAllLights();
44                 vtkLightKit *lightKit=vtkLightKit::New();
45                 //bbGetInputRenderer()->SetTwoSidedLighting(0);
46                 lightKit->SetKeyLightWarmth( bbGetInputKeyLightWarmth() );
47                 lightKit->SetFillLightWarmth( bbSetInputFillLightWarmth() );
48                 lightKit->SetBackLightWarmth( bbSetInputBackLightWarmth() );
49                 lightKit->AddLightsToRenderer( bbGetInputRenderer() );
50         }
51
52 }
53 //===== 
54 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
55 //===== 
56 void LightKit::bbUserSetDefaultValues()
57 {
58
59 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
60 //    Here we initialize the input 'In' to 0
61    bbSetInputRenderer(NULL);
62    bbSetInputKeyLightWarmth(0.8);
63    bbSetInputFillLightWarmth(5.0);
64    bbSetInputBackLightWarmth(0.5);
65 }
66 //===== 
67 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
68 //===== 
69 void LightKit::bbUserInitializeProcessing()
70 {
71
72 //  THE INITIALIZATION METHOD BODY :
73 //    Here does nothing 
74 //    but this is where you should allocate the internal/output pointers 
75 //    if any 
76
77   
78 }
79 //===== 
80 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
81 //===== 
82 void LightKit::bbUserFinalizeProcessing()
83 {
84
85 //  THE FINALIZATION METHOD BODY :
86 //    Here does nothing 
87 //    but this is where you should desallocate the internal/output pointers 
88 //    if any
89   
90 }
91 }
92 // EO namespace bbcreaVtk
93
94