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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2549 by jfenwick, Mon Jul 20 06:43:47 2009 UTC revision 2625 by jfenwick, Fri Aug 21 06:30:25 2009 UTC
# Line 20  http://www.opensource.org/licenses/osl-3 Line 20  http://www.opensource.org/licenses/osl-3
20  __url__="https://launchpad.net/escript-finley"  __url__="https://launchpad.net/escript-finley"
21    
22  """  """
23  @var __author__: name of author  :var __author__: name of author
24  @var __copyright__: copyrights  :var __copyright__: copyrights
25  @var __license__: licence agreement  :var __license__: licence agreement
26  @var __url__: url entry point on documentation  :var __url__: url entry point on documentation
27  @var __version__: version  :var __version__: version
28  @var __date__: date of the version  :var __date__: date of the version
29  """  """
30    
31  __author__="John Ngui, john.ngui@uq.edu.au"  __author__="John Ngui, john.ngui@uq.edu.au"
# Line 39  if getMPISizeWorld()==1: import vtk Line 39  if getMPISizeWorld()==1: import vtk
39  class Light:  class Light:
40      """      """
41      Class that defines a light. A light controls the lighting for the      Class that defines a light. A light controls the lighting for the
42      rendered object and works in a similar way to L{Camera <camera.Camera>}.      rendered object and works in a similar way to `Camera`.
43      """      """
44    
45      # The SOUTH_WEST default viewport is used when there is only one viewport.      # The SOUTH_WEST default viewport is used when there is only one viewport.
# Line 48  class Light: Line 48  class Light:
48          """          """
49          Initialise the light.          Initialise the light.
50    
51          @type scene: L{Scene <scene.Scene>} object          :type scene: `Scene` object
52          @param scene: Scene in which components are to be added to            :param scene: Scene in which components are to be added to  
53          @type viewport: L{Viewport <constant.Viewport>} constant          :type viewport: `Viewport` constant
54          @param viewport: Viewport in which objects are to be rendered on          :param viewport: Viewport in which objects are to be rendered on
55          """          """
56                  if getMPISizeWorld()>1:                  if getMPISizeWorld()>1:
57                       raise ValueError,"pyvisi.Light is not running on more than one processor."                       raise ValueError,"pyvisi.Light is not running on more than one processor."
# Line 70  class Light: Line 70  class Light:
70          """          """
71          Set up the light and associate it with the renderer.          Set up the light and associate it with the renderer.
72    
73          @type scene: L{Scene <scene.Scene>} object          :type scene: `Scene` object
74          @param scene: Scene in which objects are to be rendered on          :param scene: Scene in which objects are to be rendered on
75          """          """
76    
77          scene._addLight(self.__viewport, self.__vtk_light)          scene._addLight(self.__viewport, self.__vtk_light)
# Line 80  class Light: Line 80  class Light:
80          """          """
81          Set the light color.          Set the light color.
82    
83          @type color: L{Color <constant.Color>} constant          :type color: `Color` constant
84          @param color: Light color          :param color: Light color
85          """          """
86    
87          self.__vtk_light.SetColor(color)          self.__vtk_light.SetColor(color)
# Line 91  class Light: Line 91  class Light:
91          """          """
92          Set the focal point of the light.          Set the focal point of the light.
93    
94          @type position: L{GlobalPosition <position.GlobalPosition>} object          :type position: `GlobalPosition` object
95          @param position: Light focal point          :param position: Light focal point
96          """          """
97    
98          self.__vtk_light.SetFocalPoint(position._getGlobalPosition())          self.__vtk_light.SetFocalPoint(position._getGlobalPosition())
# Line 102  class Light: Line 102  class Light:
102          """          """
103          Set the position of the light.          Set the position of the light.
104    
105          @type position: L{GlobalPosition <position.GlobalPosition>} object          :type position: `GlobalPosition` object
106          @param position: Light position          :param position: Light position
107          """          """
108    
109          self.__vtk_light.SetPosition(position._getGlobalPosition())          self.__vtk_light.SetPosition(position._getGlobalPosition())
# Line 116  class Light: Line 116  class Light:
116          An alternative to set the position and focal point of the light          An alternative to set the position and focal point of the light
117          by using the elevation and azimuth.          by using the elevation and azimuth.
118    
119          @type elevation: Number          :type elevation: Number
120          @param elevation: Degree to rotate the light to the top and bottom          :param elevation: Degree to rotate the light to the top and bottom
121          @type azimuth: Number          :type azimuth: Number
122          @param azimuth: Degree to rotate the light to the left and right          :param azimuth: Degree to rotate the light to the left and right
123          """          """
124    
125          # NOTE: The elevation angle of light does not appear to suffer the same          # NOTE: The elevation angle of light does not appear to suffer the same
# Line 132  class Light: Line 132  class Light:
132          """          """
133          Set the intensity (brightness) of the light.          Set the intensity (brightness) of the light.
134    
135          @type intensity: Number          :type intensity: Number
136          @param intensity: Intensity (brightness) of the light          :param intensity: Intensity (brightness) of the light
137          """          """
138    
139          self.__vtk_light.SetIntensity(intensity)          self.__vtk_light.SetIntensity(intensity)
# Line 143  class Light: Line 143  class Light:
143          """          """
144          Return whether the Light has been modified.          Return whether the Light has been modified.
145    
146          @rtype: Boolean          :rtype: Boolean
147          @return: True or False          :return: True or False
148          """          """
149    
150          if (self.__modified == True):          if (self.__modified == True):
# Line 156  class Light: Line 156  class Light:
156          """          """
157          Render the light.          Render the light.
158    
159          @type scene: L{Scene <scene.Scene>} object          :type scene: `Scene` object
160          @param scene: Scene in which objects are to be rendered on          :param scene: Scene in which objects are to be rendered on
161          """          """
162    
163          if(self._isModified() == True):          if(self._isModified() == True):

Legend:
Removed from v.2549  
changed lines
  Added in v.2625

  ViewVC Help
Powered by ViewVC 1.1.26