Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkRenderer.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkRenderer.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00040 #ifndef __vtkRenderer_h
00041 #define __vtkRenderer_h
00042 
00043 #include "vtkViewport.h"
00044 
00045 #include "vtkVolumeCollection.h" // Needed for access in inline members
00046 #include "vtkActorCollection.h" // Needed for access in inline members
00047 
00048 class vtkRenderWindow;
00049 class vtkVolume;
00050 class vtkCuller;
00051 class vtkActor;
00052 class vtkActor2D;
00053 class vtkCamera;
00054 class vtkLightCollection;
00055 class vtkCullerCollection;
00056 class vtkLight;
00057 
00058 class VTK_RENDERING_EXPORT vtkRenderer : public vtkViewport
00059 {
00060 public:
00061   vtkTypeRevisionMacro(vtkRenderer,vtkViewport);
00062   void PrintSelf(ostream& os, vtkIndent indent);
00063 
00067   static vtkRenderer *New();
00068 
00070 
00073   void AddActor(vtkProp *p);
00074   void AddVolume(vtkProp *p);
00075   void RemoveActor(vtkProp *p);
00076   void RemoveVolume(vtkProp *p);
00078 
00080   void AddLight(vtkLight *);
00081 
00083   void RemoveLight(vtkLight *);
00084 
00086   vtkLightCollection *GetLights();
00087   
00089   void CreateLight(void);
00090   
00094   virtual vtkLight *MakeLight();
00095 
00097 
00101   vtkGetMacro(TwoSidedLighting,int);
00102   vtkSetMacro(TwoSidedLighting,int);
00103   vtkBooleanMacro(TwoSidedLighting,int);
00105 
00107 
00117   vtkSetMacro(LightFollowCamera,int);
00118   vtkGetMacro(LightFollowCamera,int);
00119   vtkBooleanMacro(LightFollowCamera,int);
00121 
00123 
00129   vtkGetMacro(AutomaticLightCreation,int);
00130   vtkSetMacro(AutomaticLightCreation,int);
00131   vtkBooleanMacro(AutomaticLightCreation,int);
00133 
00137   virtual int UpdateLightsGeometryToFollowCamera(void);
00138 
00140   vtkVolumeCollection *GetVolumes();
00141 
00143   vtkActorCollection *GetActors();
00144 
00146   void SetActiveCamera(vtkCamera *);
00147 
00151   vtkCamera *GetActiveCamera();
00152 
00156   virtual vtkCamera *MakeCamera();
00157 
00159 
00163   vtkSetMacro(Erase, int);
00164   vtkGetMacro(Erase, int);
00165   vtkBooleanMacro(Erase, int);
00167 
00169   void AddCuller(vtkCuller *);
00170 
00172   void RemoveCuller(vtkCuller *);
00173 
00175   vtkCullerCollection *GetCullers();
00176 
00178 
00179   vtkSetVector3Macro(Ambient,double);
00180   vtkGetVectorMacro(Ambient,double,3);
00182 
00184 
00186   vtkSetMacro(AllocatedRenderTime,double);
00187   virtual double GetAllocatedRenderTime();
00189 
00194   virtual double GetTimeFactor();
00195 
00198   virtual void Render();
00199 
00202   virtual void DeviceRender() =0;
00203 
00205   virtual void Clear() {};
00206 
00208   int VisibleActorCount();
00209 
00211   int VisibleVolumeCount();
00212 
00215   void ComputeVisiblePropBounds( double bounds[6] );
00216 
00218   double *ComputeVisiblePropBounds();
00219 
00222   void ResetCameraClippingRange();
00223 
00225 
00227   void ResetCameraClippingRange( double bounds[6] );
00228   void ResetCameraClippingRange( double xmin, double xmax, 
00229                                  double ymin, double ymax, 
00230                                  double zmin, double zmax);
00232 
00234 
00238   vtkSetClampMacro(NearClippingPlaneTolerance,double,0,0.99);
00239   vtkGetMacro(NearClippingPlaneTolerance,double);
00241 
00247   void ResetCamera();
00248 
00256   void ResetCamera(double bounds[6]);
00257 
00259 
00260   void ResetCamera(double xmin, double xmax, double ymin, double ymax, 
00261                    double zmin, double zmax);
00263 
00265 
00268   void SetRenderWindow(vtkRenderWindow *);
00269   vtkRenderWindow *GetRenderWindow() {return this->RenderWindow;};
00270   virtual vtkWindow *GetVTKWindow();
00272   
00274 
00277   vtkSetMacro(BackingStore,int);
00278   vtkGetMacro(BackingStore,int);
00279   vtkBooleanMacro(BackingStore,int);
00281 
00283 
00286   vtkSetMacro(Interactive,int);
00287   vtkGetMacro(Interactive,int);
00288   vtkBooleanMacro(Interactive,int);
00290 
00292 
00294   vtkSetMacro(Layer, int);
00295   vtkGetMacro(Layer, int);
00297 
00300   int  Transparent();
00301 
00303   void WorldToView();
00304 
00306 
00307   void ViewToWorld();
00308   virtual void ViewToWorld(double &wx, double &wy, double &wz);
00310 
00312   virtual void WorldToView(double &wx, double &wy, double &wz);
00313 
00316   double GetZ (int x, int y);
00317 
00319   unsigned long GetMTime();
00320 
00322 
00323   vtkGetMacro( LastRenderTimeInSeconds, double );
00325 
00327 
00331   vtkGetMacro( NumberOfPropsRendered, int );
00333 
00339   vtkAssemblyPath* PickProp(double selectionX, double selectionY);
00340 
00344   virtual void StereoMidpoint() { return; };
00345 
00350   double GetTiledAspectRatio();
00351   
00352 protected:
00353   vtkRenderer();
00354   ~vtkRenderer();
00355 
00356   // internal method for doing a render for picking purposes
00357   virtual void PickRender(vtkPropCollection *props);
00358   virtual void PickGeometry();
00359   
00360   vtkCamera *ActiveCamera;
00361   vtkLight  *CreatedLight;
00362 
00363   vtkLightCollection *Lights;
00364   vtkCullerCollection *Cullers;
00365 
00366   vtkActorCollection *Actors;
00367   vtkVolumeCollection *Volumes;
00368   
00369   double              Ambient[3];  
00370   vtkRenderWindow    *RenderWindow;
00371   double              AllocatedRenderTime;
00372   double              TimeFactor;
00373   int                TwoSidedLighting;
00374   int                AutomaticLightCreation;
00375   int                BackingStore;
00376   unsigned char      *BackingImage;
00377   int                BackingStoreSize[2];
00378   vtkTimeStamp       RenderTime;
00379 
00380   double              LastRenderTimeInSeconds;
00381 
00382   int                LightFollowCamera;
00383 
00384   // Allocate the time for each prop
00385   void               AllocateTime();
00386 
00387   // Internal variables indicating the number of props
00388   // that have been or will be rendered in each category.
00389   int                NumberOfPropsRendered;
00390 
00391   // A temporary list of props used for culling, and traversal
00392   // of all props when rendering
00393   vtkProp            **PropArray;
00394   int                PropArrayCount;
00395 
00396   // A temporary list used for picking
00397   vtkAssemblyPath    **PathArray;
00398   int                PathArrayCount;
00399 
00400   // Indicates if the renderer should receive events from an interactor.
00401   // Typically only used in conjunction with transparent renderers.
00402   int                Interactive;
00403 
00404   // Shows what layer this renderer belongs to.  Only of interested when
00405   // there are layered renderers.
00406   int                Layer;
00407 
00408   // Holds the result of ComputeVisiblePropBounds so that it is visible from
00409   // wrapped languages
00410   double              ComputedVisiblePropBounds[6];
00411 
00417   double              NearClippingPlaneTolerance;
00418 
00423   int Erase;
00424 
00428   virtual int UpdateGeometry(void);
00429 
00432   virtual int UpdateCamera(void);
00433 
00437   virtual int UpdateLightGeometry(void);
00438 
00441   virtual int UpdateLights(void) {return 0;};
00442 
00445   vtkCamera *GetActiveCameraAndEventuallyReset();
00446   
00447 private:
00448   vtkRenderer(const vtkRenderer&);  // Not implemented.
00449   void operator=(const vtkRenderer&);  // Not implemented.
00450 };
00451 
00452 inline vtkLightCollection *vtkRenderer::GetLights() {
00453   return this->Lights;
00454 }
00455 
00457 inline vtkCullerCollection *vtkRenderer::GetCullers(){return this->Cullers;}
00458 
00459 
00460 #endif

Generated on Mon Jan 21 23:07:36 2008 for VTK by  doxygen 1.4.3-20050530