/[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 860 - (hide annotations)
Thu Sep 28 08:17:29 2006 UTC (14 years, 3 months ago) by jongui
File MIME type: text/x-python
File size: 1433 byte(s)
- added sample drivers on how to use all of the currently available modules.
- completed the epydocs for all the currently available modules.
- added the rotation feature for camera and plane cutting.


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 846 @type scene: L{Scene <scene.Scene>} object
16 jongui 839 @param scene: Scene in which components are to be added to
17 jongui 837 """
18    
19 jongui 839 self.scene = scene
20 jongui 852 self.vtk_light = vtk.vtkLight()
21 jongui 830
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 839 self.scene.getRenderer().AddLight(self.vtk_light)
29 jongui 830
30 jongui 860 def setColor(self, color):
31 jongui 837 """
32 jongui 860 Set the light color.
33     @type color: RGB list
34     @param color: Color of the light
35 jongui 837 """
36 jongui 830
37 jongui 860 self.vtk_light.SetColor(color[0], color[1], color[2])
38 jongui 830
39 jongui 837 def setFocalPoint(self, position):
40     """
41     Set the focal point of the light.
42     @type position: L{Position <geo.Position>} object
43 jongui 860 @param position: Light focal point
44 jongui 837 """
45    
46     self.vtk_light.SetFocalPoint(position.getXCoor(), position.getYCoor(),
47     position.getZCoor())
48    
49     def setPosition(self, position):
50     """
51     Set the position of the light.
52     @type position: L{Position <geo.Position>} object
53     @param position: Light position
54     """
55    
56     self.vtk_light.SetPosition(position.getXCoor(), position.getYCoor(),
57     position.getZCoor())
58    
59 jongui 830 def setIntensity(self, intensity):
60 jongui 837 """
61     Set the intensity (brightness) of the light.
62     @type intensity: Number
63 jongui 860 @param intensity: Intensity (brightness) of the light
64 jongui 837 """
65    
66 jongui 830 self.vtk_light.SetIntensity(intensity)
67 jongui 837

  ViewVC Help
Powered by ViewVC 1.1.26