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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 860 - (show 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 """
2 @author: John Ngui
3 @author: Lutz Gross
4 """
5
6 import vtk
7
8 class Light:
9 """
10 Class that controls the light and its settings.
11 """
12
13 def __init__(self, scene):
14 """
15 @type scene: L{Scene <scene.Scene>} object
16 @param scene: Scene in which components are to be added to
17 """
18
19 self.scene = scene
20 self.vtk_light = vtk.vtkLight()
21
22 self.setLight()
23
24 def setLight(self):
25 """
26 Set up the light and associate it with the renderer.
27 """
28 self.scene.getRenderer().AddLight(self.vtk_light)
29
30 def setColor(self, color):
31 """
32 Set the light color.
33 @type color: RGB list
34 @param color: Color of the light
35 """
36
37 self.vtk_light.SetColor(color[0], color[1], color[2])
38
39 def setFocalPoint(self, position):
40 """
41 Set the focal point of the light.
42 @type position: L{Position <geo.Position>} object
43 @param position: Light focal point
44 """
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 def setIntensity(self, intensity):
60 """
61 Set the intensity (brightness) of the light.
62 @type intensity: Number
63 @param intensity: Intensity (brightness) of the light
64 """
65
66 self.vtk_light.SetIntensity(intensity)
67

  ViewVC Help
Powered by ViewVC 1.1.26