• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Rendering/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 =========================================================================*/
00037 #ifndef __vtkRenderer_h
00038 #define __vtkRenderer_h
00039 
00040 #include "vtkViewport.h"
00041 
00042 #include "vtkVolumeCollection.h" // Needed for access in inline members
00043 #include "vtkActorCollection.h" // Needed for access in inline members
00044 
00045 class vtkRenderWindow;
00046 class vtkVolume;
00047 class vtkCuller;
00048 class vtkActor;
00049 class vtkActor2D;
00050 class vtkCamera;
00051 class vtkLightCollection;
00052 class vtkCullerCollection;
00053 class vtkLight;
00054 class vtkPainter;
00055 class vtkIdentColoredPainter;
00056 class vtkHardwareSelector;
00057 class vtkRendererDelegate;
00058 class vtkRenderPass;
00059 
00060 #if !defined(VTK_LEGACY_REMOVE)
00061 class vtkVisibleCellSelector;
00062 #endif
00063 
00064 
00065 class VTK_RENDERING_EXPORT vtkRenderer : public vtkViewport
00066 {
00067 public:
00068   vtkTypeRevisionMacro(vtkRenderer,vtkViewport);
00069   void PrintSelf(ostream& os, vtkIndent indent);
00070 
00074   static vtkRenderer *New();
00075 
00077 
00080   void AddActor(vtkProp *p);
00081   void AddVolume(vtkProp *p);
00082   void RemoveActor(vtkProp *p);
00083   void RemoveVolume(vtkProp *p);
00085 
00087   void AddLight(vtkLight *);
00088 
00090   void RemoveLight(vtkLight *);
00091 
00093   void RemoveAllLights();
00094 
00096   vtkLightCollection *GetLights();
00097   
00099   void CreateLight(void);
00100   
00104   virtual vtkLight *MakeLight();
00105 
00107 
00111   vtkGetMacro(TwoSidedLighting,int);
00112   vtkSetMacro(TwoSidedLighting,int);
00113   vtkBooleanMacro(TwoSidedLighting,int);
00115 
00117 
00127   vtkSetMacro(LightFollowCamera,int);
00128   vtkGetMacro(LightFollowCamera,int);
00129   vtkBooleanMacro(LightFollowCamera,int);
00131 
00133 
00139   vtkGetMacro(AutomaticLightCreation,int);
00140   vtkSetMacro(AutomaticLightCreation,int);
00141   vtkBooleanMacro(AutomaticLightCreation,int);
00143 
00147   virtual int UpdateLightsGeometryToFollowCamera(void);
00148 
00150   vtkVolumeCollection *GetVolumes();
00151 
00153   vtkActorCollection *GetActors();
00154 
00156   void SetActiveCamera(vtkCamera *);
00157 
00161   vtkCamera *GetActiveCamera();
00162 
00166   virtual vtkCamera *MakeCamera();
00167 
00169 
00173   vtkSetMacro(Erase, int);
00174   vtkGetMacro(Erase, int);
00175   vtkBooleanMacro(Erase, int);
00177 
00179 
00182   vtkSetMacro(Draw, int);
00183   vtkGetMacro(Draw, int);
00184   vtkBooleanMacro(Draw, int);
00186 
00188   void AddCuller(vtkCuller *);
00189 
00191   void RemoveCuller(vtkCuller *);
00192 
00194   vtkCullerCollection *GetCullers();
00195 
00197 
00198   vtkSetVector3Macro(Ambient,double);
00199   vtkGetVectorMacro(Ambient,double,3);
00201 
00203 
00205   vtkSetMacro(AllocatedRenderTime,double);
00206   virtual double GetAllocatedRenderTime();
00208 
00213   virtual double GetTimeFactor();
00214 
00217   virtual void Render();
00218 
00221   virtual void DeviceRender() =0;
00222 
00227   virtual void DeviceRenderTranslucentPolygonalGeometry();
00228   
00230   virtual void Clear() {};
00231 
00233   int VisibleActorCount();
00234 
00236   int VisibleVolumeCount();
00237 
00240   void ComputeVisiblePropBounds( double bounds[6] );
00241 
00243   double *ComputeVisiblePropBounds();
00244 
00247   void ResetCameraClippingRange();
00248 
00250 
00252   void ResetCameraClippingRange( double bounds[6] );
00253   void ResetCameraClippingRange( double xmin, double xmax, 
00254                                  double ymin, double ymax, 
00255                                  double zmin, double zmax);
00257 
00259 
00263   vtkSetClampMacro(NearClippingPlaneTolerance,double,0,0.99);
00264   vtkGetMacro(NearClippingPlaneTolerance,double);
00266 
00272   void ResetCamera();
00273 
00281   void ResetCamera(double bounds[6]);
00282 
00284 
00285   void ResetCamera(double xmin, double xmax, double ymin, double ymax, 
00286                    double zmin, double zmax);
00288 
00290 
00293   void SetRenderWindow(vtkRenderWindow *);
00294   vtkRenderWindow *GetRenderWindow() {return this->RenderWindow;};
00295   virtual vtkWindow *GetVTKWindow();
00297   
00299 
00302   vtkSetMacro(BackingStore,int);
00303   vtkGetMacro(BackingStore,int);
00304   vtkBooleanMacro(BackingStore,int);
00306 
00308 
00311   vtkSetMacro(Interactive,int);
00312   vtkGetMacro(Interactive,int);
00313   vtkBooleanMacro(Interactive,int);
00315 
00317 
00319   vtkSetMacro(Layer, int);
00320   vtkGetMacro(Layer, int);
00322 
00324 
00326   vtkSetMacro(PreserveDepthBuffer, int);
00327   vtkGetMacro(PreserveDepthBuffer, int);
00328   vtkBooleanMacro(PreserveDepthBuffer, int);
00330 
00333   int  Transparent();
00334 
00336   void WorldToView();
00337 
00339 
00340   void ViewToWorld();
00341   virtual void ViewToWorld(double &wx, double &wy, double &wz);
00343 
00345   virtual void WorldToView(double &wx, double &wy, double &wz);
00346 
00349   double GetZ (int x, int y);
00350 
00352   unsigned long GetMTime();
00353 
00355 
00356   vtkGetMacro( LastRenderTimeInSeconds, double );
00358 
00360 
00364   vtkGetMacro( NumberOfPropsRendered, int );
00366 
00368 
00373   vtkAssemblyPath* PickProp(double selectionX, double selectionY)
00374     {
00375       return this->PickProp(selectionX, selectionY, selectionX, selectionY);
00376     }
00377   vtkAssemblyPath* PickProp(double selectionX1, double selectionY1,
00378                             double selectionX2, double selectionY2);
00380 
00384   virtual void StereoMidpoint() { return; };
00385 
00390   double GetTiledAspectRatio();
00391 
00393 
00396   int IsActiveCameraCreated() 
00397     { return (this->ActiveCamera != NULL); }
00399   
00400   
00402 
00408   vtkSetMacro(UseDepthPeeling,int);
00409   vtkGetMacro(UseDepthPeeling,int);
00410   vtkBooleanMacro(UseDepthPeeling,int);
00412   
00414 
00421   vtkSetClampMacro(OcclusionRatio,double,0.0,0.5);
00422   vtkGetMacro(OcclusionRatio,double);
00424   
00426 
00429   vtkSetMacro(MaximumNumberOfPeels,int);
00430   vtkGetMacro(MaximumNumberOfPeels,int);
00432   
00434 
00436   vtkGetMacro(LastRenderingUsedDepthPeeling,int);
00438   
00440 
00444   void SetDelegate(vtkRendererDelegate *d);
00445   vtkGetObjectMacro(Delegate,vtkRendererDelegate);
00447 
00448   //BTX
00450 
00451   void SetPass(vtkRenderPass *p);
00452   vtkGetObjectMacro(Pass,vtkRenderPass);
00453   //ETX
00455   
00457 
00460   vtkGetObjectMacro(Selector, vtkHardwareSelector);
00462 //BTX
00463 protected:
00464   vtkRenderer();
00465   ~vtkRenderer();
00466 
00467   // internal method for doing a render for picking purposes
00468   virtual void PickRender(vtkPropCollection *props);
00469   virtual void PickGeometry();
00470   
00471   vtkCamera *ActiveCamera;
00472   vtkLight  *CreatedLight;
00473 
00474   vtkLightCollection *Lights;
00475   vtkCullerCollection *Cullers;
00476 
00477   vtkActorCollection *Actors;
00478   vtkVolumeCollection *Volumes;
00479   
00480   double              Ambient[3];  
00481   vtkRenderWindow    *RenderWindow;
00482   double              AllocatedRenderTime;
00483   double              TimeFactor;
00484   int                TwoSidedLighting;
00485   int                AutomaticLightCreation;
00486   int                BackingStore;
00487   unsigned char      *BackingImage;
00488   int                BackingStoreSize[2];
00489   vtkTimeStamp       RenderTime;
00490 
00491   double              LastRenderTimeInSeconds;
00492 
00493   int                LightFollowCamera;
00494 
00495   // Allocate the time for each prop
00496   void               AllocateTime();
00497 
00498   // Internal variables indicating the number of props
00499   // that have been or will be rendered in each category.
00500   int                NumberOfPropsRendered;
00501 
00502   // A temporary list of props used for culling, and traversal
00503   // of all props when rendering
00504   vtkProp            **PropArray;
00505   int                PropArrayCount;
00506 
00507   // A temporary list used for picking
00508   vtkAssemblyPath    **PathArray;
00509   int                PathArrayCount;
00510 
00511   // Indicates if the renderer should receive events from an interactor.
00512   // Typically only used in conjunction with transparent renderers.
00513   int                Interactive;
00514 
00515   // Shows what layer this renderer belongs to.  Only of interested when
00516   // there are layered renderers.
00517   int                Layer;
00518   int                PreserveDepthBuffer;
00519 
00520   // Holds the result of ComputeVisiblePropBounds so that it is visible from
00521   // wrapped languages
00522   double              ComputedVisiblePropBounds[6];
00523 
00529   double              NearClippingPlaneTolerance;
00530 
00535   int Erase;
00536 
00540   int Draw;
00541 
00545   virtual int UpdateGeometry(void);
00546 
00551   virtual int UpdateTranslucentPolygonalGeometry();
00552   
00555   virtual int UpdateCamera(void);
00556 
00560   virtual int UpdateLightGeometry(void);
00561 
00564   virtual int UpdateLights(void) {return 0;};
00565 
00568   vtkCamera *GetActiveCameraAndResetIfCreated();
00569 
00573   int UseDepthPeeling;
00574   
00582   double OcclusionRatio;
00583    
00587   int MaximumNumberOfPeels;
00588   
00591   int LastRenderingUsedDepthPeeling;
00592   
00593 #if !defined(VTK_LEGACY_REMOVE)
00594   // VISIBLE CELL SELECTION ----------------------------------------
00595   friend class vtkVisibleCellSelector;
00596 
00598 
00601   enum {NOT_SELECTING = 0, COLOR_BY_PROCESSOR, COLOR_BY_ACTOR, 
00602         COLOR_BY_CELL_ID_HIGH, COLOR_BY_CELL_ID_MID, COLOR_BY_CELL_ID_LOW,
00603         COLOR_BY_VERTEX};  
00605 
00606   vtkSetMacro(SelectMode, int);
00607   vtkSetMacro(SelectConst, unsigned int);
00608 
00611   void SetIdentPainter(vtkIdentColoredPainter*);
00612   
00614   virtual int UpdateGeometryForSelection(void);
00615 
00617 
00619   vtkPainter* SwapInSelectablePainter(vtkProp *, 
00620                                               int &);
00622 
00624 
00626   void SwapOutSelectablePainter(vtkProp *,
00627                                 vtkPainter*, 
00628                                 int );
00630 
00632 
00633   vtkProp            **PropsSelectedFrom;
00634   int                PropsSelectedFromCount;
00636 
00637   // Ivars for visible cell selecting
00638   int SelectMode;
00639   unsigned int SelectConst;
00640   vtkIdentColoredPainter *IdentPainter;
00641   // End Ivars for visible cell selecting.
00642 #endif
00643 
00644   // HARDWARE SELECTION ----------------------------------------
00645   friend class vtkHardwareSelector;
00646 
00648 
00649   void SetSelector(vtkHardwareSelector* selector)
00650     { this->Selector = selector; this->Modified(); }
00652 
00653   // End Ivars for visible cell selecting.
00654   vtkHardwareSelector* Selector;
00655 
00656   //---------------------------------------------------------------
00657   friend class vtkRendererDelegate;
00658   vtkRendererDelegate *Delegate;
00659 
00660   friend class vtkRenderPass;
00661   vtkRenderPass *Pass;
00662   
00663 private:
00664   vtkRenderer(const vtkRenderer&);  // Not implemented.
00665   void operator=(const vtkRenderer&);  // Not implemented.
00666 //ETX
00667 };
00668 
00669 inline vtkLightCollection *vtkRenderer::GetLights() {
00670   return this->Lights;
00671 }
00672 
00674 inline vtkCullerCollection *vtkRenderer::GetCullers(){return this->Cullers;}
00675 
00676 
00677 #endif

Generated by  doxygen 1.7.1