Changeset 3683 for trunk/packages/vizservers/vtkvis/Renderer.cpp
- Timestamp:
- Jun 12, 2013, 2:51:11 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/Renderer.cpp
r3680 r3683 20 20 #include <vtkCamera.h> 21 21 #include <vtkLight.h> 22 #include <vtkLightCollection.h> 22 23 #include <vtkCoordinate.h> 23 24 #include <vtkTransform.h> … … 124 125 //_renderer->SetAmbient(.2, .2, .2); 125 126 127 _renderer->AutomaticLightCreationOff(); 128 126 129 vtkSmartPointer<vtkLight> headlight = vtkSmartPointer<vtkLight>::New(); 127 130 headlight->SetLightTypeToHeadlight(); … … 130 133 //headlight->SetAmbientColor(1, 1, 1); 131 134 _renderer->AddLight(headlight); 135 132 136 vtkSmartPointer<vtkLight> skylight = vtkSmartPointer<vtkLight>::New(); 133 137 skylight->SetLightTypeToCameraLight(); … … 138 142 //skylight->SetAmbientColor(1, 1, 1); 139 143 _renderer->AddLight(skylight); 144 140 145 _renderer->LightFollowCameraOn(); 141 146 _renderWindow = vtkSmartPointer<vtkRenderWindow>::New(); … … 3177 3182 mergeGraphicsObjectBounds<Disk>(bounds, onlyVisible); 3178 3183 mergeGraphicsObjectBounds<Glyphs>(bounds, onlyVisible); 3184 mergeGraphicsObjectBounds<Group>(bounds, onlyVisible); 3179 3185 mergeGraphicsObjectBounds<HeightMap>(bounds, onlyVisible); 3180 3186 mergeGraphicsObjectBounds<LIC>(bounds, onlyVisible); … … 3818 3824 } 3819 3825 3826 int Renderer::addLight(float pos[3]) 3827 { 3828 vtkSmartPointer<vtkLight> light = vtkSmartPointer<vtkLight>::New(); 3829 light->SetLightTypeToCameraLight(); 3830 light->SetPosition(pos[0], pos[1], pos[2]); 3831 light->SetFocalPoint(0, 0, 0); 3832 light->PositionalOff(); 3833 _renderer->AddLight(light); 3834 _needsRedraw = true; 3835 return (_renderer->GetLights()->GetNumberOfItems()-1); 3836 } 3837 3838 vtkLight *Renderer::getLight(int lightIdx) 3839 { 3840 vtkLightCollection *lights = _renderer->GetLights(); 3841 if (lights->GetNumberOfItems() < lightIdx+1) 3842 return NULL; 3843 lights->InitTraversal(); 3844 vtkLight *light = NULL; 3845 int i = 0; 3846 do { 3847 light = lights->GetNextItem(); 3848 } while (i++ < lightIdx); 3849 return light; 3850 } 3851 3852 void Renderer::setLightSwitch(int lightIdx, bool state) 3853 { 3854 vtkLight *light = getLight(lightIdx); 3855 if (light == NULL) { 3856 ERROR("Unknown light %d", lightIdx); 3857 return; 3858 } 3859 light->SetSwitch((state ? 1 : 0)); 3860 _needsRedraw = true; 3861 } 3862 3820 3863 /** 3821 3864 * \brief Initialize the camera zoom region to include the bounding volume given
Note: See TracChangeset
for help on using the changeset viewer.