/[escript]/trunk/pyvisi/py_src/light.py
ViewVC logotype

Annotation of /trunk/pyvisi/py_src/light.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 839 - (hide annotations)
Wed Sep 6 04:53:50 2006 UTC (15 years ago) by jongui
File MIME type: text/x-python
File size: 1548 byte(s)
- Added lookup table spectrum from blue to red and red to blue.
- Updated open scene to scene

1 gross 792 """
2 jongui 839 @author: John Ngui
3     @author: Lutz Gross
4 gross 792 """
5    
6 jongui 830 import vtk
7 gross 792
8 jongui 830 class Light:
9 jongui 837 """
10 jongui 839 Class that controls the light and its settings.
11 jongui 837 """
12 jongui 830
13 jongui 839 def __init__(self, scene):
14 jongui 837 """
15 jongui 839 @type scene: L{OpenScene <scene.Scene>} object
16     @param scene: Scene in which components are to be added to
17 jongui 837 """
18    
19 jongui 839 self.scene = scene
20 jongui 830 self.vtk_light = None
21    
22     self.setLight()
23    
24     def setLight(self):
25 jongui 837 """
26     Set up the light and associate it with the renderer.
27     """
28 jongui 830 self.vtk_light = vtk.vtkLight()
29 jongui 839 self.scene.getRenderer().AddLight(self.vtk_light)
30 jongui 830
31 jongui 837 def setColor(self, colorMap):
32     """
33     Set the color of the light.
34    
35     @type colorMap: L{ColorMap <colormap.ColorMap>} object
36     @param colorMap: Color of the light
37     """
38 jongui 830
39 jongui 837 self.vtk_light.SetColor(colorMap.getR(), colorMap.getG(),
40     colorMap.getB())
41 jongui 830
42    
43 jongui 837 def setFocalPoint(self, position):
44     """
45     Set the focal point of the light.
46    
47     @type position: L{Position <geo.Position>} object
48     @param position: Light focal point position
49     """
50    
51     self.vtk_light.SetFocalPoint(position.getXCoor(), position.getYCoor(),
52     position.getZCoor())
53    
54     def setPosition(self, position):
55     """
56     Set the position of the light.
57    
58     @type position: L{Position <geo.Position>} object
59     @param position: Light position
60     """
61    
62     self.vtk_light.SetPosition(position.getXCoor(), position.getYCoor(),
63     position.getZCoor())
64    
65 jongui 830 def setIntensity(self, intensity):
66 jongui 837 """
67     Set the intensity (brightness) of the light.
68    
69     @type intensity: Number
70     @param intensity: intensity (brightness) of the light
71     """
72    
73 jongui 830 self.vtk_light.SetIntensity(intensity)
74 jongui 837
75    
76    

  ViewVC Help
Powered by ViewVC 1.1.26