/[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 852 - (show annotations)
Wed Sep 20 03:23:16 2006 UTC (14 years, 10 months ago) by jongui
File MIME type: text/x-python
File size: 1520 byte(s)
added carpet and isosurface


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, colorMap):
31 """
32 Set the color of the light.
33
34 @type colorMap: L{ColorMap <colormap.ColorMap>} object
35 @param colorMap: Color of the light
36 """
37
38 self.vtk_light.SetColor(colorMap.getR(), colorMap.getG(),
39 colorMap.getB())
40
41
42 def setFocalPoint(self, position):
43 """
44 Set the focal point of the light.
45
46 @type position: L{Position <geo.Position>} object
47 @param position: Light focal point position
48 """
49
50 self.vtk_light.SetFocalPoint(position.getXCoor(), position.getYCoor(),
51 position.getZCoor())
52
53 def setPosition(self, position):
54 """
55 Set the position of the light.
56
57 @type position: L{Position <geo.Position>} object
58 @param position: Light position
59 """
60
61 self.vtk_light.SetPosition(position.getXCoor(), position.getYCoor(),
62 position.getZCoor())
63
64 def setIntensity(self, intensity):
65 """
66 Set the intensity (brightness) of the light.
67
68 @type intensity: Number
69 @param intensity: intensity (brightness) of the light
70 """
71
72 self.vtk_light.SetIntensity(intensity)
73
74
75

  ViewVC Help
Powered by ViewVC 1.1.26