/[escript]/temp_trunk_copy/pyvisi/py_src/camera.py
ViewVC logotype

Diff of /temp_trunk_copy/pyvisi/py_src/camera.py

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

revision 1148 by jongui, Wed May 16 22:45:33 2007 UTC revision 1158 by jongui, Tue May 22 04:24:01 2007 UTC
# Line 26  class Camera: Line 26  class Camera:
26          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
27          """          """
28    
         self.__scene = scene  
29          self.__viewport = viewport          self.__viewport = viewport
30          self.__vtk_camera = vtk.vtkCamera()          self.__vtk_camera = vtk.vtkCamera()
31    
# Line 35  class Camera: Line 34  class Camera:
34          # Keeps track whether the modification to the camera was due to the          # Keeps track whether the modification to the camera was due to the
35          # instantiation. If it is, then __setupCamera() method is called.          # instantiation. If it is, then __setupCamera() method is called.
36          self.__initialization = True          self.__initialization = True
37          self.__scene._addVisualizationModules(self)          scene._addVisualizationModules(self)
38    
39      def __setupCamera(self):      def __setupCamera(self, scene):
40          """          """
41          Setup the camera.          Setup the camera.
42    
43            @type scene: L{Scene <scene.Scene>} object
44            @param scene: Scene in which objects are to be rendered on
45          """          """
46    
47          # Assign the camera to the appropriate renderer          # Assign the camera to the appropriate renderer
48          self.__scene._setActiveCamera(self.__viewport, self.__vtk_camera)          scene._setActiveCamera(self.__viewport, self.__vtk_camera)
49          self.__resetCamera()              self.__resetCamera(scene)  
50    
51      def setFocalPoint(self, position):      def setFocalPoint(self, position):
52          """          """
# Line 184  class Camera: Line 186  class Camera:
186          self.__vtk_camera.Dolly(distance)          self.__vtk_camera.Dolly(distance)
187          self.__modified = True          self.__modified = True
188    
189      def __resetCameraClippingRange(self):      def __resetCameraClippingRange(self, scene):
190          """          """
191          Reset the camera clipping range based on the bounds of the visible          Reset the camera clipping range based on the bounds of the visible
192          actors. This ensures the rendered object is not cut-off.          actors. This ensures the rendered object is not cut-off.
193          Needs to be called whenever the camera's settings are modified.          Needs to be called whenever the camera's settings are modified.
194    
195            @type scene: L{Scene <scene.Scene>} object
196            @param scene: Scene in which objects are to be rendered on
197          """          """
198    
199          self.__scene._getRenderer()[self.__viewport].ResetCameraClippingRange()          scene._getRenderer()[self.__viewport].ResetCameraClippingRange()
200    
201      def __resetCamera(self):      def __resetCamera(self, scene):
202          """          """
203          Repositions the camera to view the center point of the actors.          Repositions the camera to view the center point of the actors.
204    
205            @type scene: L{Scene <scene.Scene>} object
206            @param scene: Scene in which objects are to be rendered on
207          """          """
208    
209          self.__scene._getRenderer()[self.__viewport].ResetCamera()          scene._getRenderer()[self.__viewport].ResetCamera()
210    
211      def _isModified(self):      def _isModified(self):
212          """          """
# Line 213  class Camera: Line 221  class Camera:
221          else:          else:
222              return False              return False
223    
224      def _render(self):      def _render(self, scene):
225          """          """
226          Render the camera.          Render the camera.
227    
228            @type scene: L{Scene <scene.Scene>} object
229            @param scene: Scene in which objects are to be rendered on
230          """          """
231    
232          if(self._isModified() == True):          if(self._isModified() == True):
233              # Will only be true once only when the camera is instantiated.              # Will only be true once only when the camera is instantiated.
234              if(self.__initialization == True):              if(self.__initialization == True):
235                  self.__setupCamera()                  self.__setupCamera(scene)
236                  self.__initialization == False                  self.__initialization == False
237    
238              self.__resetCameraClippingRange()              self.__resetCameraClippingRange(scene)
239              self.__isModified = False              self.__isModified = False
240                            
241    

Legend:
Removed from v.1148  
changed lines
  Added in v.1158

  ViewVC Help
Powered by ViewVC 1.1.26